Comment

Comment by thinkpad20

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.

parent thinkpad20 11 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton