|
|
|
|
|
by thinkpad20
3831 days ago
|
|
One advantage I could see of Rust over D for language stuff is sum types (enums in Rust). So for example you can write: enum MyLanguage {
Var(String),
Int(i32),
Sum(Box<MyLang>, Box<MyLang>),
Let(String, Box<MyLang>, Box<MyLang>)
}
(Apologies if I got a few things wrong; I just mean the general idea)Seems like without a construct like this, you'd have to use subclasses or something similar, which (to me) isn't quite as nice. |
|
alias MyLanguage = VariantN!(<insert types here>);