Hacker News new | past | comments | ask | show | jobs | submit login

no the feature you're looking for is sealed classes, see e.g. Kotlin. Rust enum variants cannot be externally defined classes



That's completely orthogonal to ADT vs enum.


Enums enable two things: check current type from union of types and exhaustivity check in switch

The former is solved by reflection, the latter by sealed classes.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: