dtolnay / case-studies

Analysis of various tricky Rust code
Apache License 2.0
1.7k stars 46 forks source link

object oriented emulation #3

Closed richard-uk1 closed 5 years ago

richard-uk1 commented 5 years ago

I haven't fully thought this through, but I think you could emulate a class hierarchy using repr[transparent] and mem::transmute on references. This hasn't been done I assume because there is no reason a sane person would do this 😋

dtolnay commented 5 years ago

Seems plausible!