News for hackers. Stuff that matters.
Re:Announcing Rust 1.0 Alpha by riffraff on Friday January 09, 2015 @04:51PM (#8864748)
is it really "so nice"? I wish they had been able to go forward with typestate :(
Re:Announcing Rust 1.0 Alpha by aturon on Friday January 09, 2015 @05:52PM (#8865007)
This is a very old post, but you can encode many uses of typestate pretty easily: http://pcwalton.github.io/blog/2012/12/26/typestate-is-dead/

It'd be great for someone to write a more up-to-date version of this post!

Re:Announcing Rust 1.0 Alpha by Solarsail on Friday January 09, 2015 @09:12PM (#8865598)
Haven't used Rust, but I wonder what you could use in place of the phantom types? Are Traits capable of filling this role? Am I completely misreading what Traits are?

Can Rust still do phantom types, and I just can't see them anywhere in the language reference?

Re:Announcing Rust 1.0 Alpha by xKingfisher on Friday January 09, 2015 @09:32PM (#8865641)
You should still be able to use phantom types with empty traits or enums. Here's an article[0] (admittedly from ~6 months ago), about using phantom types in Servo.

[0] https://blog.mozilla.org/research/2014/06/23/static-checking...

Re:Announcing Rust 1.0 Alpha by Jweb_Guru on Friday January 09, 2015 @09:19PM (#8865607)
Rust can still do phantom types.

    struct Foo<T>; // `T` is a phantom type parameter.
Re:Announcing Rust 1.0 Alpha by vedosity on Saturday January 10, 2015 @03:05PM (#8867739)
Phantom types aren't part of the language because they don't need to be. They're just empty types used as type parameters for structs, where the type parameter isn't actually used as a variable in the struct. It is more of a design pattern than a language feature.
Re:Announcing Rust 1.0 Alpha by vhbit on Saturday January 10, 2015 @12:39AM (#8866042)
Yes, you can read a bit about collections and how phantom types are used in them http://cglab.ca/~abeinges/blah/rust-btree-case/