Re:Announcing Rust 1.0 Alpha
by gnuvince on Friday January 09, 2015 @03:14PM
(#8864233)
Wow. Anyone remembers Rust pre-0.1? When it had typestate, ML syntax, garbage collection, etc.? So nice to see how the language slowly evolved and was molded to fit as best as possible the problem they were trying to solve.
[ Parent
| on HN ]
It's been a fascinating metamorphosis, undeniably. I'm going to attempt to turn it into an interesting talk for the tentative Rust conference that may be happening this year. :)
Just started to learn Rust. Could you show me examples of this ancient ML syntax? Just curious how it would look like.
> the language slowly evolved and was molded to fit as best as possible the problem they were trying to solve.
Which is...? Wikipedia says [1]
> "to be a good language for the creation of large client and server programs that run over the Internet"
and that looks too vague to me.
[1] http://en.wikipedia.org/wiki/Rust_%28programming_language%29...
Re:Announcing Rust 1.0 Alpha
by steveklabnik on Friday January 09, 2015 @07:14PM
(#8865277)
Memory safety without garbage collection.
Agreed. I think that description should be updated.
Wasn't garbage collection actually always just planned but never realized (other than reference counting)?
Yes, I worked on GC as a summer project. Turned out to be way harder than anyone had thought because LLVM isn't really set up to handle high performance GC. I have a talk on it here:
Re:Announcing Rust 1.0 Alpha
by steveklabnik on Friday January 09, 2015 @05:34PM
(#8864925)
Sort of, yeah. Gc<T> was just refcount + simple cycle detection.
is it really "so nice"? I wish they had been able to go forward with typestate :(
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!
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...
Rust can still do phantom types.
struct Foo<T>; // `T` is a phantom type parameter.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.
Yes, you can read a bit about collections and how phantom types are used in them http://cglab.ca/~abeinges/blah/rust-btree-case/
Yeah, looking through the early commits is really eye-opening.