4 ms·
no the feature you're looking for is sealed classes, see e.g. Kotlin. Rust enum variants cannot be externally defined classes
by SemanticStrengh 4y ago
no the feature you're looking for is sealed classes, see e.g. Kotlin.
Rust enum variants cannot be externally defined classes
- the_duke 4y agoThat's completely orthogonal to ADT vs enum.
- SemanticStrengh 4y agoEnums 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.