News for hackers. Stuff that matters.
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by sepeth on Tuesday May 05, 2015 @12:46PM (#9493469)
FP languages have algebraic data types for this. Why do they call it virtual structs? How are they different than ADTs?
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by jarrettc on Tuesday May 05, 2015 @12:55PM (#9493525)
Rust has algebraic data types. They're one of Rust's most important features.

But algebraic data types do not in themselves provide a way to express the notion of a type with variants or sub-types.

Re:Virtual Structs Part 1: Where Rust’s Enum Shines by eddyb on Tuesday May 05, 2015 @01:15PM (#9493643)
"Virtual Structs" is a name for a potential feature that may expose some sort of structural inheritance or subtyping.

The name is not used for the current "enum" feature, which is one of the few ADTs in Rust (there's also "struct" and tuples - not sure what else qualifies).

Re:Virtual Structs Part 1: Where Rust’s Enum Shines by pdpi on Tuesday May 05, 2015 @01:45PM (#9493839)
enum gives you sum types, struct/tuples provide product types. That's pretty vanilla ADTs sorted. GADTs are a whole other can of worms though.
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by Ygg2 on Tuesday May 05, 2015 @04:39PM (#9494824)
This is part one: The good part of Rust's ADT/Enum system. Next I presume is the bad part of it - namely how it caused pain when implementing DOM in Servo.
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by cmrx64 on Tuesday May 05, 2015 @01:17PM (#9493658)
Rust enums are ADTs.