News for hackers. Stuff that matters.
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by saosebastiao on Tuesday May 05, 2015 @12:48PM (#9493484)
Rust was the first language in which I used tagged unions. While I can't say that I use Rust at the moment (not mature enough and too low-level for my current needs), I found pattern matching and tagged unions so beneficial and practical that now I refuse to use any language that doesn't have them. Currently I'm writing a bunch of code in F#.

I don't know what the language of the future will be but I can't imagine it not having an ML heritage.

Re:Virtual Structs Part 1: Where Rust’s Enum Shines by vezzy-fnord on Tuesday May 05, 2015 @03:05PM (#9494280)
ML-style pattern matching is neat. There's actually an entire formal logic of computation oriented around it called the pattern calculus, though it's still in relatively early research.

That said, the language with the most powerful pattern matching engine I've used so far has been Erlang. Just about everything there is intimately tied to it, giving it a homoiconicity between the code and the literal data types. You can even pattern match on binary formats, like file headers or packet structures.

It seems like Algol-like languages are slowly absorbing lessons from ML. Rust is quite an evident example.

Re:Virtual Structs Part 1: Where Rust’s Enum Shines by gnuvince on Tuesday May 05, 2015 @02:38PM (#9494130)
I needed to write a small AST in Java, and I actually had to write the definition in ML on a sheet of paper to see how to do it. It's so weird that so many languages don't have sum types.
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by sixbrx on Tuesday May 05, 2015 @02:50PM (#9494208)
What's too bad is that Java had a chance to handle alternatives properly as sum types, when enums were being added. But the designers chose instead of sum types, to add them as yet another kind of "object" that have to have a common constructor (and thus the exact same backing data) and methods. So basically all the variants have to be of the same "shape". Very disappointing!
Re:Virtual Structs Part 1: Where Rust’s Enum Shines by sanderjd on Tuesday May 05, 2015 @06:52PM (#9495507)
This has been my experience with Rust as well. Came for the C/C++ competitor, stayed for the type system. Also not using it for anything "real" yet, but excited to at some point.