7 ms·
Rust 0.9 released
- kibwen 13y agoA selection of some of my favorite aspects of this release: 1. The (yet-ongoing) removal of managed pointers, leaving us with one fewer pointer type. Final tally of built-in pointer types: unique pointers, mutable references, and immutable references. 2. The dead code detection pass (https://github.com/mozilla/rust/pull/10477 https://github.com/mozilla/rust/pull/10477), contributed by a student of the University of Virginia's Rust-based systems programming class (http://rust-class.org/pages/using-rust-for-an-undergraduate-os-course.html http://rust-class.org/pages/using-rust-for-an-undergraduate-...). 3. The `Any` trait, giving us on-demand dynamic typing (https://github.com/mozilla/rust/pull/9967 https://github.com/mozilla/rust/pull/9967). 4. The clean abstraction of green threads and native threads out into their own libraries (https://mail.mozilla.org/pipermail/rust-dev/2013-December/007565.html https://mail.mozilla.org/pipermail/rust-dev/2013-December/00...) such that any library that makes use of the stdlib will work regardless of which strategy the user selects. We're not quite in the home stretch yet, but there are very few hard blockers left on 1.0. Here's the list that I can think of: 1. Dynamically-sized types (http://smallcultfollowing.com/babysteps/blog/2014/01/05/dst-take-5/ http://smallcultfollowing.com/babysteps/blog/2014/01/05/dst-...) 2. The extension of rvalue lifetimes (http://smallcultfollowing.com/babysteps/blog/2014/01/09/rvalue-lifetimes-in-rust/ http://smallcultfollowing.com/babysteps/blog/2014/01/09/rval...) 3. Struct single (note that's single) inheritance (http://smallcultfollowing.com/babysteps/blog/2013/10/24/single-inheritance/ http://smallcultfollowing.com/babysteps/blog/2013/10/24/sing...) 4. Niceties and sugar to support custom smart pointer types to complete the excision of managed pointers As far as I know, the devs are still aiming for a 1.0 release in 2014. The 1.0 release will not necessarily mean that the language is done evolving or ready for production use, but it will mean that the developers will begin honoring language-level and library-level backwards compatibility. I would expect at least two more unstable point releases (i.e. 0.10 and 0.11) before a 1.0 release occurs.
- Ygg2 13y agoAren't unique pointer also scheduled for decommission?
- kibwen 13y agoNo, not at all. Unique pointers are awesome and are the foundation for lots of other features. Now, some of the syntax for using them might still change. That's yet to be decided. But it wouldn't be Rust without unique pointers.
- pcwalton 13y agoUndecided. They will always be somewhat magical in that the "box" operator creates them by default. But the syntax for them may change, or be moved into the library.
- dded 13y agoYou can put a pointer type into a library?
- lucian1900 13y agoRc and Gc are now libraries you can import. A nice advantage is that Arc, MutexArc and any other reference types look and work the same way.
- Touche 13y agoDocumenting Rust must be a major pain.
- steveklabnik 13y agoDisclaimer: I've written a bunch of it. It's actually not too bad. The biggest problem with the docs currently is that it's a patched-together set of things people have written at random over the last few years. Mozilla has taken some concrete steps to address this, it'll be much better overall soon.
- Touche 13y agoSorry, I was making a joke about how Rust changes a lot. You guys do great work considering.
- steveklabnik 13y agoHa, no worries. Thanks!
- dbaupp 13y agoThis release also heralds the ability for the built-in documentation generator to run any code examples, which has helped us keep the documentation up-to-date a lot.
- weavie 13y agoExcellent. It was the multitude of different pointer types that confused me the most, so it's great to hear that they are simplifying this.
- steveklabnik 13y agoMy guide got merged in for this release: http://static.rust-lang.org/doc/0.9/guide-pointers.html http://static.rust-lang.org/doc/0.9/guide-pointers.html TL;DR: you don't need them as much as you may think, so don't let that scare you away!
- pcwalton 13y agoInheritance may not make 1.0.
- kibwen 13y agoAh, news to me. I guess it can be introduced without breaking backwards-compatibility.
- Ycros 13y agoI'm finding that my OO code style these days is very composition heavy with pretty much no inheritance use. I think given Rust's type system, I'm not going to miss inheritance much.
- zanny 13y agoAs someone who writes a lot of C++ and has played with Rust (ie, hello world) how does the language work when you remove shared pointers? Say I have an early-generated state tracker for a whole bunch of events propagating in an event loop somewhere, that I want discarded when all the events finish. They are all separate tasks in different threads, so I either need to have some job that just checks if they all finish to clean up, or pass around shared data structures. How would you do that in Rust?
- banachtarski 13y agoI actually make it a point to do most of my code without shared_ptr, opting instead for unique_ptr. There was a talk somewhere about the "best written library you should never use" and shared_ptr was the focus. For the example you mentioned, you could have the parent object of those tasks responsible for cleanup of the shared object (e.g. each thread's destructor calls a finish function on the parent object). This is just one possible implementation. I don't encounter this as much because I prefer a shared-nothing approach where possible. edit:typo
- jmgrosen 13y agoIf the structure is immutable after you've produced it, you can use extra::arc::Arc<T> [0], and once all the references are dropped the memory will be deallocated. I haven't used C++, so this might be very similar to std::shared_ptr or not, but this is usually what one would use in Rust. (There's also extra::arc::RWArc<T> [1] when you need mutability, but that isn't used much in my experience.) [0] http://static.rust-lang.org/doc/master/extra/arc/struct.Arc.html http://static.rust-lang.org/doc/master/extra/arc/struct.Arc.... [1] http://static.rust-lang.org/doc/master/extra/arc/struct.RWArc.html http://static.rust-lang.org/doc/master/extra/arc/struct.RWAr...
- saosebastiao 13y agoSo is the next milestone 1.0 or 0.10?
- steveklabnik 13y ago0.10
- babo 13y agowith finalized pointers?
- steveklabnik 13y agoWhat do you mean?
- babo 13y agoThese deep changes with pointers holds me back to try out rust. Last I checked rust was a week ago, none of the pointer related documentation or examples were compatible with the head revision. Putting energy of the released version felt bad as that will break soon but head is not that useful without documentation. The same goes since summer, I'm looking for a stable codebase with documentation and base libraries.
- jvns 13y agoIf you're looking for a stable language you shouldn't use Rust right now. The language is still changing every few days. If you have a bit more time to spend it's fun, though -- I spent a lot of time in the IRC channel. The people in #rust are really helpful and will answer all your pointer questions.
- steveklabnik 13y agoSome of the syntax has been changing, but the semantics have been the same.
- bjz_ 13y agoAs always, drop by irc.mozilla.org #rust if you'd like to chat or ask questions. We're a friendly bunch! http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust http://chat.mibbit.com/?server=irc.mozilla.org&channel=%23ru...
- bencollier49 13y agoRust does seem to do lots of good and interesting stuff. I was trying to find a small number of languages covering all paradigms, and Rust featured on the final list: https://news.ycombinator.com/item?id=7026970 https://news.ycombinator.com/item?id=7026970
- copx 13y agoWasn't this release supposed to finally offer a Windows package which works out-of-the-box? I just tried it. Only got an error message about a missing GCC component. Seriously, a ~90MB download and that still does not include all the GCC dependencies? We still have to somehow manually setup a version of MinGW compatible with this particular build? Who is in charge of the Windows port? A Linux user who cross-compiles from an Arch box? No way a Windows user would think that Windows package is acceptable. I mean, I am not paying anything for it so it is not that I think I have the right to demand better packages but you are losing out on a massive amount of feedback from the Windows world by only offering such downloads. You are largely limiting yourself to determined people who are already familiar with MinGW-based C/C++ development on Windows (that is a small subset of Windows devs). What about people coming from - say C#? You expect them to fiddle with a MinGW setup just to build "Hello World"? Sorry, but for me this experiment with Rust ended just like the 0.8 one. Downloaded Windows installer, ran Windows installer, tried to compile Hello World, got error message about missing components, uninstall, delete.
- kibwen 13y ago> Wasn't this release supposed to finally offer a Windows > package which works out-of-the-box? Nope! No idea where you got that impression. > Who is in charge of the Windows port? We keep asking for people knowledgeable about Windows to step forward and lead the effort to port us off MinGW and onto MSVC, and none ever have. Would you like to volunteer? :) To clarify, the goal is to be using the native Windows toolchain by 1.0, if at all feasible. Servo has to work on Windows, after all.
- rybosome 13y agoI really want Rust to succeed, but I'm not a systems programmer. Do people feel that there is still a place for Rust among those who typically work with higher-level languages? The functional aspects and type system of Rust look really appealing, and I'd love to do my part to help it do well by actually using it.
- steveklabnik 13y agoI am primarily a Rubyist, but I'm head over heels for Rust. I'm pretty sure I've inculcated wycats with similar feels. You might be interested in http://words.steveklabnik.com/rust-is-surprisingly-expressive http://words.steveklabnik.com/rust-is-surprisingly-expressiv... , which is sort of about this.
- bascule 13y agoDitto for me, but I came from a largely C background prior to Ruby
- kibwen 13y agoI was exclusively a Javascript/Python/Java programmer before jumping into Rust. If you're looking to learn a systems language with real bare-metal capabilities, Rust's safety features will go a long way towards keeping you on the straight and narrow as you figure out the concepts essential to low-level programming. And because Steve seems reluctant to plug his own book, here's Rust for Rubyists, which is an introduction to Rust geared towards users of higher-level programming languages: http://www.rustforrubyists.com/ http://www.rustforrubyists.com/
- steveklabnik 13y agoThis reminded me that I needed to actually release the 0.9 update I wrote over the weekend! Thanks :)
- arms 13y agoThanks kibwen for the link, and thanks steveklabnik for writing this. I've been interested in Rust and this looks like a nice way to get my feet wet.
- Dewie 13y agoOT: Is Rust using operator overloading? Is user-defined operators a possibility in the future? I googled it and the most I could find was this: http://www.reddit.com/r/rust/comments/1le6vu/i_wrote_a_prototype_parser_combinator_in_rust_and/cbyh50y http://www.reddit.com/r/rust/comments/1le6vu/i_wrote_a_proto...
- steveklabnik 13y agoYou want to check out std::ops http://static.rust-lang.org/doc/master/std/ops/index.html http://static.rust-lang.org/doc/master/std/ops/index.html
- kibwen 13y agoOperator overloading, yes. But we place some restrictions on which types you can overload in order to keep things sane (oversimplified explanation: you must have declared the types yourself in order to overload operators on them). We also discourage the wanton overloading of operators to mean completely random things, as you might have encountered in C++. As for user-defined operators, if you mean something like Haskell's custom infix operators then no, I don't believe there are any plans for those.
- Dewie 13y agoI think that Reddit thread was interesting. The syntax is taken from Haskell, but someone brought up ditching precedence and only associating in one direction, which I guess is simpler than operator overloading(?)
- JoshTriplett 13y ago> As for user-defined operators, if you mean something like Haskell's custom infix operators then no, I don't believe there are any plans for those. Do the Rust designers actively oppose having them, or just not have any concrete plans to add them?
- kibwen 13y agoMerely lukewarm, I think. There are simply much higher priorities to focus on at the moment. Who knows what Rust 2.0 might hold!
- eonil 13y agoOf course I welcome removal of GC syntax, but I am getting in doubt on when Rust language specification can be stabilized. Version 0.9 seems it must be stable now, but they're still putting big changes on the language.
- panzi 13y agoIn general: One cannot expect a 0.x version to be stable/won't be followed by a incompatible version. A 1.x version is a different story.
- Pacabel 13y agoWell, it's understandable where the concern is coming from. We've seen 0.x releases of Rust for nearly two full years now, and even the most recent ones have had significant changes. While we've heard that a 1.0 release is planned for sometime during 2014, there's little to suggest that things are actually stabilizing. It isn't Perl 6 yet, but the ongoing lack of stability is making some potential Rust users become skeptical.
- pcwalton 13y agoThere have been fewer and fewer breaking language changes over time. The migration from 0.8 to 0.9 was less of a burden than the migration from 0.7 to 0.8, and so on. There is also a lot of progress on making a list of blocking issues, and at this point if anything can be added backwards compatibly it is almost always not a priority for 1.0. Making a safe programming language that doesn't require GC or a runtime (while allowing allocation) has literally never been done before in industry. It has taken time to get something usable. The current overall design seems pretty workable now, as evidenced by all the projects people are starting to write, so I think it's basically just a matter of finishing off rough edges at this point.
- steveklabnik 13y agoIf anyone's curious, here's all it took me to update Rust for Rubyists from 0.8 to 0.9: https://github.com/steveklabnik/rust_for_rubyists/commit/ae27bcfc349450e3491e420c71f93357fb4c0f6d https://github.com/steveklabnik/rust_for_rubyists/commit/ae2...
- vorg 13y ago> normalized to Unicode normalization form NFKC I'm wondering why they chose NFKC (compatibility composed from) instead of NFC (canonically composed form). `ª` would become `a`, losing its super type. `ᵤ` becomes `u`, losing its sub type? `Ⓐ` becomes `A`, losing its circle type. As for multi-codepoint mappings, `¼` would become three tokens `1⁄4`, where `⁄` (U+2044) doesn't map to `/` (U+002F).
- dbaupp 13y agoI don't see any mention of normalisation in the release notes.
- lifthrasiir 13y agoMaybe you are referring the reference [1], which indeed mentions NFKC. As far as I know there is no consensus of the normalization form [2] and the current implementation is not guaranteed to stay, which is why Unicode identifiers are gated behind a `#[feature]` flag. [1] http://static.rust-lang.org/doc/0.9/rust.html#input-format http://static.rust-lang.org/doc/0.9/rust.html#input-format [2] https://github.com/mozilla/rust/issues/2253 https://github.com/mozilla/rust/issues/2253
- dbaupp 13y ago(Also, as that bug suggests, we don't actually do any normalisation at all yet.)
- vorg 13y agoYes, I started reading the reference. The normalization form issue is different to the #[non_ascii_idents] feature, though. The issue 2253 does mention address it, but all the comments mention the issue of NFC/NFKC normalization specifically for filesystem lookup and for program identifiers, but not for the lexing stage. That issue is obviously the best place to continue any conversation about it.
- tarpden 13y agoAre there any plans to further simplify and/or pare down the language?
- dbaupp 13y agoYes, the @ built-in pointer is being removed as special, replaced by library types like Rc and Gc (for reference counting and garbage collection respectively). There's a vague suggestion for ~ to become a library pointer too, but I don't think this has been totally accepted by the core team. (This would leave only raw pointers and references actually defined in the language.) There are some plans related to simplifying how vectors and trait objects ("dynamically sized types" or DST) interact but I don't understand them well enough to be able to explain. :)
- saurabhnanda 13y agoI'vr been 'stalking' Rust for quite some time, but never got around to diving in. I'm essentially a web programer who's been building fairly large web based systems. I'm sick of dealing with programming languages that consume shitloads of resources (CPU, memory, whatever) for doing essentially trivial stuff (compared to the amount of resources they use). Will Rust be able to help me write super-efficient web programs, than run blazingly fast and dont gobble-up RAM? Besides, how painful/easy is string manipulation in Rust?
- kibwen 13y agoYes, Rust will super-efficient, blazingly-fast, and memory-lean. But it's not nearly as good at rapid prototyping as, say, Ruby, so you'll have to temper your expectations. String manipulation in Rust is currently lacking while we work on the API. We also strictly enforce that all strings are UTF-8, so while this gives us great confidence that we're future-proof it adds a whole lot of difficulty in implementing a fast and correct means to work with strings.
- saurabhnanda 13y agoCan you elaborate why UTF-8 makes things harder? Is it because 1-byte no longer means one character? So, something like calculating a string's length is also tricky. Is that it? Also, where can I read about the general direction the string manipulation API is going to take?
- kibwen 13y agoThe bigger problem is that Unicode is immense and complex, and trying to implement the full specification is rather daunting. There's no real documents concerning the future of the string API, right now people are just implementing things as they need them.