i had a great convo with a few months ago about how to match on trait objects like non exhaustive enums and how we might do derived “vtable impls” to let enums play as trait objects
i had several other much worse ideas about enum/trait obj equivalence too
Conversation
yeah imo enums should be traits over their variant types and basically just "inline trait objects", and we should get the exact same treatment in reverse
3
2
9
Kind of going backwards to Scala’s encoding of enums (using sealed traits)?
1
5
Funnily enough, Scala 3 (Dotty) now has Rust inspired sugar over sealed traits: dotty.epfl.ch/docs/reference - they have GADTs too though which I would looove in Rust.
1
3
Wait, what?! 😮
1
3
Deferent hehe, sorry! 😅
1
2
"Generalised Algebraic Data Types", originally known as "Inductive Types" in dependent type land.




