3 ms·
It's not a class, it's a struct (as a value type), it's fine if you disagree with the idea of OOP, but don't come in with an incorrect assumption of how the lan
by Profan 10y ago
It's not a class, it's a struct (as a value type), it's fine if you disagree with the idea of OOP, but don't come in with an incorrect assumption of how the language is actually used in the wild.
But sure, I would agree that having a natively implemented variant type would be better, even if this one can serve many of the same purposes.
Class = reference type, supports polymorphism, inheritance
Struct = value type, does not support polymorphism, inheritance
The variant type based on a struct is implemented through the language's metaprogramming facilities.