12 ms·
Rust 0.6 Released
- pjmlp 14y agoGreat! Time to upgrade. Just as a side note, I am looking forward to the day I won't need to recompile LLVM as well.
- film42 14y agoCall me a noob, but I have never been properly introduced to Rust. Does anyone know of a good article or walk through with pros, cons, and examples?
- metajack 14y agoThis is the best talk I've seen on Rust so far. http://www.infoq.com/presentations/Rust http://www.infoq.com/presentations/Rust The tutorial is also pretty good (as are the supplemental tutorials), but they don't yet give you the full picture. For that you'll have to play and experiment and read some code. You might start here for some code to read: https://github.com/pcwalton/sprocketnes https://github.com/pcwalton/sprocketnes
- kibwen 14y agoThe language is still changing so fast that nearly every resource that you'll find will be outdated. Your best bet is likely the official tutorial,[1] which probably doesn't contain too many references to deprecated features. [1] http://static.rust-lang.org/doc/tutorial.html http://static.rust-lang.org/doc/tutorial.html
- ineedtosleep 14y agoWhat parts of the language have been changing? And maybe to reduce the scope of that question a bit: are there any specific features that need to be solidified first before someone should bother learning Rust?
- dbaupp 14y agoRecently the biggest breaking changes have been a large amount of syntax removed from the language: https://github.com/mozilla/rust/issues/4707 https://github.com/mozilla/rust/issues/4707 But, as far as I understand, the goal is to not change the syntax much from now, and actually get it 'frozen' by 0.7.
- usea 14y agoI am no language expert by any means, but I haven't had much trouble picking up Rust. In fact it's been a lot of fun. I've mostly used the official documentation [1](tutorial, manual, core/std reference). Sometimes I will have to look at some unit tests on the rust github source to see how something is used. [1] http://www.rust-lang.org/ http://www.rust-lang.org/
- mcguire 14y agoI started playing with it when 0.5 came out, and the changes that I've seen when I went with a pre-0.6 build are not what I would consider major. There are many of them, but most are either relatively minor syntactic issues or in darker corners of the language that I haven't needed to touch yet.
- steveklabnik 14y agoI wrote a 'book' (it's about 50 pages) you can read online called "Rust for Rubyists". Two things: It's for 0.5 (I'll be updating it to 0.6 later today/tomorrow) and 'for Rubyists' means I assume you don't know anything about systems programming, there's very little that's Ruby-specific. http://www.rustforrubyists.com/ http://www.rustforrubyists.com/
- abraininavat 14y ago'for Rubyists' means I assume you don't know anything about systems programming, there's very little that's Ruby-specific. Then put out the same book with a new title, "Rust for Pythonistas". Two books for the price of one!
- steveklabnik 14y agoI've thought about it. ;) Primarily, this was an experiment in 'selling your byproducts'.[1] I'm already self-publishing a book on Hypermedia APIs[2], and the older system it was in couldn't handle my new requirements. I also wanted to learn Rust, and so I decided to just write it all down as I went. It also enabled me to get familiar enough with my new tooling that when it came time to port over DHAs, it wasn't bad at all. So yes, doing the same thing 'for other languages' would be fun, and if Rust continues to take off, I might give it a shot. I'm already planning on writing more content for the book as I go; I've been working on a Rust buildpack for Heroku... 1: http://37signals.com/svn/posts/1620-sell-your-by-products http://37signals.com/svn/posts/1620-sell-your-by-products 2: http://www.designinghypermediaapis.com/ http://www.designinghypermediaapis.com/
- drbawb 14y agoThis isn't a tutorial, but I found pcwalton's explanation of memory management in rust[0] to be an excellent primer for the different allocation techniques in rust. Learning the different types of pointers was a real pain point for me; so I'm very thankful for this post. Maybe it will help you out while you're learning! [0]: http://pcwalton.github.com/blog/2013/03/18/an-overview-of-memory-management-in-rust/ http://pcwalton.github.com/blog/2013/03/18/an-overview-of-me...
- kibwen 14y agoAnyone who found that post illuminating may also enjoy this general "Rust for C++ programmers" reference: https://github.com/mozilla/rust/wiki/Rust-for-CXX-programmers https://github.com/mozilla/rust/wiki/Rust-for-CXX-programmer...
- ksec 14y agoSlightly Off Topic: Wasn't Rust suppose to be the codename or working name of the languages. Or Has Mozilla decide to simply use Rust as its official name?
- icambron 14y agoI don't know the answer to that, but the problem may be that Rust is decent enough name to overcome any proposed name changes. I've always thought you should use implausible codenames for just this reason. It forces you to change it instead of just letting the codename establish itself by momentum. I've always assumed that's why Microsoft uses terrible codenames like "Longhorn".
- chimeracoder 14y agoWhen developing Java, Sun figured out a way around this.... which is how we ended up with the name Swing: https://blogs.oracle.com/thejavatutorials/entry/why_is_swing_called_swing https://blogs.oracle.com/thejavatutorials/entry/why_is_swing...
- ovis 14y agoThat must have backfired for the Fedora folks.
- nnethercote 14y agoI'm pretty sure Graydon always intended Rust to be the final name.
- coldtea 14y agoNever heard something about it being just a codename. Why would it be? Rust is quite nice itself and has already 1-2 years of being established. It even makes sense as an faux-etymology. Rust: because it's close to the metal and brings some breathing oxygen to the stale system's language arena...
- shared4you 14y agoPrevious discussion just 3 days back: https://news.ycombinator.com/item?id=5468896 https://news.ycombinator.com/item?id=5468896 [This was for RC though]
- wrl 14y ago`Static methods no longer require the `static` keyword and instead are distinguished by the lack of a `self` parameter` Man, am I the only one who really doesn't like implicit things like this?
- efuquen 14y agoWell, it does kind of make sense. If you never access anything from self then for all intent and purposes there is no reason the function shouldn't be static. That's just my initial perspective reading your comment, not knowing much about the language, so I might be missing some possible scenario this would actually result in a runtime error.
- deleted 14y ago[deleted]
- jeremyjh 14y agoActually I think its much more explicit that self is ALWAYS passed as a parameter, or it doesn't exist.
- pcwalton 14y agoThis change improves consistency between implementations and modules. `impl MyType { … }` is now just like `mod my_module { … }`, except that you can define methods inside `impl` declarations by including a self parameter. For example: struct MyType { … } impl MyType { pub fn foo() { … } } mod my_module { pub fn foo() { … } } fn main() { MyType::foo(); // works my_module::foo(); // works too }
- kzrdude 14y agoYour comment is funny since the other part of the change you cited is the introduction of explicit self.
- charlescearl 14y agoJust glanced at the discussion on LtU http://lambda-the-ultimate.org/node/4009 http://lambda-the-ultimate.org/node/4009, I wonder if the C++ hackers have swallowed, and if they are hearding them onto Haskell?
- steveklabnik 14y agoThat discussion is very old.
- charlescearl 14y agoQuite, but I generally use as a way to gauge "language innovation" relevance. It looks like the lag time on getting into innovative programming principles into production languages is ~5 years. The discussion is quite interesting in laying out some of the practical issues with introducing PL research concepts into code that must support large products and large developer bases.
- steveklabnik 14y agoYeah, seems good. I was just excited for a new discussion, then saw that it was from a while back, and given how much Rust has changed in the meantime, wanted to make sure others didn't think it was new.
- mcguire 14y agoIf you see mention of "typestate" in Rust, the discussion is probably so far out of date as to be useless in learning Rust as it is now.
- terhechte 14y agoIt is interesting how many of these newer languages clearly try to improve upon a specific older, established language (at least imho) (take with a grain of salt). C++ -> Rust C -> Go Java -> Scala Lisp -> Closure Erlang -> (Go or Scala) Javascript -> (Too Many; Dart, et al) (Edit: Formatting)
- Kototama 14y agoIt's Clojure, not Closure. Google Closure is an optimizing JavaScript to JavaScript compiler. I'm not sure Go try to replace C. Most (all?) embedded systems need to control memory allocations.
- jff 14y agoWhere does C imply embedded only? The Go authors spent years writing non-embedded programs and operating systems in C, after Ken Thompson laid the groundwork to create C.
- Kototama 14y agoI didn't want to imply that. Just that some use of C won't be covered by Go.
- pjmlp 14y ago> I'm not sure Go try to replace C. Most (all?) embedded systems need to control memory allocations. Are you aware that there are embedded systems coded in GC enabled languages? It is all a matter of the available resources.
- abraininavat 14y agoIt is all a matter of the available resources. I'd say, it's all a matter of the guarantees. Guarantees are everything in embedded systems.
- deleted 14y ago
- drbawb 14y agoAwesome! I'm going to compile `release-0.6` right now, because I've been having some issues w/ trunk these past few days. Simple things like declaring fixed vectors won't compile for me: `let numbers: ~[int, ..3] = [1,2,3];` fails to compile saying it expected `~[int * 3] and got ~[<VI2>]`. That's an example straight from the tutorial. I'm getting segfaults when iterating over a non-fixed vector of owned elements casted to a trait. (This works fine if I access the elements directly; or use managed pointers. With owned pointers my `len()` method returns the wrong number of elements, which I suspect is breaking the iterators.)
- pcwalton 14y agoThe tutorial examples are run as part of the test suite. The tutorial example in question is `let numbers: [int, ..3] = [1, 2, 3];`, which should work. There are several known compiler bugs with any trait types other than `@Trait`. Please do continue to file any bugs you find, though—all crash bugs are bugs that need to be fixed :)
- drbawb 14y agoWhoops, I did botch up the syntax on my listed example. I compiled release-0.6; and sure enough `let numbers: [int, ..3] = [1,2,3];` compiles. `let numbers: ~[int, ..3] = ~[1,2,3];` does not compile on my system though. Ditto for the @ sigil. (Expected `~[int * 3] but found ~[<VI2>]`) My understanding is that the first example [from the docs] allocates the vector on the stack. My uncompilable examples should be equivalent except that they use the heap for storage. Is there a reason this shouldn't compile? Thanks so much for the reply!
- spicyj 14y agoIn fact you just want: let numbers: ~[int] = ~[1,2,3]; When you allocate a vector on the heap, you don't need to specify the size.
- drbawb 14y agoI was thinking you might have a function that operates on some fixed length vector. For e.g: `fn foo(bar: ~[int, ..3]) { ... }`, and the compiler would enforce that you only pass vectors of length 3 to that function. But since I can't get `~[int, ..3] = ~[1,2,3]` (etc.) to compile that seems to be impossible w/ vectors on the heap?
- steveklabnik 14y agoFrom the release notes[1]: > While we cannot promise that this is the last time there will be incompatible > changes, the great majority of anticipated language-level changes are > complete in this version I'm quite excited about this. 1: https://github.com/mozilla/rust/wiki/Doc-detailed-release-notes#06-april-2013 https://github.com/mozilla/rust/wiki/Doc-detailed-release-no...
- PommeDeTerre 14y agoThe most exciting thing about Rust is that we keep seeing something that's already pretty good continually getting better and better. This is much different than what we're seeing with the evolution of, say, JavaScript or PHP. There, the languages are pretty horrific to begin with. Any "improvements" tend to be yet another hack layered upon one or more earlier hacks. Even in the best cases, these "improvements" are merely bringing JavaScript and PHP to where many other languages were 10 or 20 years ago (if not going back much earlier). I think the fact that Rust is already so coherent makes these improvements and refinements much more impressive. It's much harder, and requires more real innovation, to improve something that's already great to begin with. Yet that's exactly what we're seeing with Rust.
- gcr 14y agoWhat "improvements" are you seeing with Javascript? The language is essentially done; all improvements I've seen come in the form of new libraries (jquery et al), environments (v8/nodejs), or revisions (jsnext, asmjs) that IE won't ever adopt.
- steveklabnik 14y agoEveryone I know is really excited for ES6.
- coldtea 14y ago>What "improvements" are you seeing with Javascript? Harmony (ES6). Isn't it obvious? >or revisions (jsnext, asmjs) that IE won't ever adopt. Seeing that MS caught up in the Javascript JIT game, offer Node.js for Azure, and added HTML5 features, SVG, CSS transformations and even WebGL in the latest IE head why would you say they'll never adopt JsNext? Heck, even them adopting asm.js is not much of a stretch.
- mhartl 14y agoMozilla and the Rust community are pleased to announce version 0.6 of the Rust compiler and associated tools. Rust is a systems programming language with a focus on safety, performance and concurrency. This is how you do an announcement right: you include a short description of the product along with the announcement. This way people who don't know WTF Rust is are immediately brought up to speed.