Rust 0.10 released
mail.mozilla.org
mail.mozilla.org
- Managed (GC-ed) pointers are moved to the standard library. There is no special syntax (formerly `@`) nor special header (for vectors containing managed pointers) required.
- Special treatments on `str` and `[T]` vectors are being generalized ("Dynamically Sized Types").
- Lifetimes of temporary expressions have changed in somewhat more intuitive way.
- Syntax extensions are now exportable, documentable and much more flexible ("procedural macro").
- Language simplifications: `do` syntactic sugar is removed, `priv` is now default, no trait bounds by default (e.g. formerly `:Send` was implied for `~Trait`).
- The smart pointer usage has been improved with new `Deref` and `DerefMut` traits.
- There are now many auxiliary standard libraries instead of a single `extra` library.
- Usual library fixes, redesigns and influx took place. Most prominent change is an introduction of growable vector type, `Vec<T>`, which subsumes the original `~[T]` type.
- Rustpkg is gone, long live Cargo! Rustc has also combined many related options into umbrella flags (e.g. `-C`).
As prior point releases of Rust did, Rust 0.10 does not represent a significant milestone. It is always recommended to use the most recent development version (master) of Rust, but it had been a great undertaking to compile Rust from scratch. From 0.10 onwards, however, there are official nightly versions [1] and brave souls can play with master more conveniently now. (They are currently not signed yet, so take that in mind.)
[1] https://mail.mozilla.org/pipermail/rust-dev/2014-March/00922...
> Managed (GC-ed) pointers are moved to the standard library.
Most uses of the old managed pointer scheme have been excised, but not all just yet (though we have people working on it with great vigor and tireless devotion). They're behind a feature flag though, so it's not possible to use them by accident.For example, note that the replacement type in question, std::gc::Gc, is still internally backed by the old managed pointers, although this will not be the case once we finally implement a proper garbage collector. And even then if you really need multiple owners of a single value we'd really prefer that you use our reference-counted pointer (std::rc::Rc) instead, along with weak pointers (std::rc::Weak) if your data has cycles. Reference counting in Rust is generally surprisingly cheap, since the refcount only gets bumped if you explicitly clone the pointer; otherwise the pointer simply gets passed around as an owned value.
* Automatically-generated nightly binaries for all first-tier platforms [1]
* Switching the default hashmap over to Robin Hood hashing [2]
* Turning on native threading by default, in lieu of the green thread runtime [3]
* The removal of conditions in favor of a standardized type for returning I/O results, which will (by default) generate a warning if the result is ignored [4]
* The extension of the lifetimes of temporary values, which should greatly reduce the occasions where you have to assign a name to a temporary result in an effort to please the compiler [5] [6]
And if you're thrown by the idea that version 0.10 follows version 0.9, know that I voted for 0.A (alas). 1.0 is still expected for later this year, though no promises!
Remember, Rust 1.0 is not the milestone when the language is finished, but rather the milestone when backwards-incompatible changes to the language will no longer be made. See the "backcompat-lang" tag on the issue tracker for a list of outstanding blockers. [7]
[1] https://mail.mozilla.org/pipermail/rust-dev/2014-March/00922...
[2] https://github.com/mozilla/rust/pull/12081
[3] https://github.com/mozilla/rust/pull/12833
[4] https://mail.mozilla.org/pipermail/rust-dev/2014-February/00...
[5] http://smallcultfollowing.com/babysteps/blog/2014/01/09/rval...
[6] https://github.com/mozilla/rust/pull/11585
[7] https://github.com/mozilla/rust/issues?direction=asc&labels=...
Curious about rationale for this. Have details?
> Memory mapped I/O is also an incredibly important feature for I/O performance, and there's almost no reason to use traditional I/O on 64-bit. However, it's a no-go with M:N scheduling because the page faults block the thread.
This is more or less why Java switched to native threads a decade and a half ago. Although in that case, it was page faults from hitting swap rather than memory-mapped IO. And in both cases, compatibility with existing native code which makes blocking system calls was also a consideration. It's reassuring that Rust is following a path well-worn by other serious languages.
Now it's just a question of waiting for Go and Node to do the same.
mmap is even worse on Windows. Windows has no madvise(), OSX equivalent is pathetic. OSX and Windows read mmaped files in bizzarely small chunks, etc.
mmap has the worst error-handling semantics of all IO methods. Linux gives you a super-hard-to-wrap SIGBUS, Windows forces use of slightly-less-horrific SEH http://msdn.microsoft.com/en-us/library/windows/desktop/aa36...
That might be the talk you are thinking about. I am keeping an eye on this. If we can have our cake and eat too w.r.t green threads and performance I will be very happy.
When I last read the tutorial, I read master instead of 0.9, and thought that the existence of the managed box in the tutorial was only due to it not yet being updated. But the 0.10 tutorial retains references to managed boxes using thee sigil @.
Is the tutorial not yet updated? Did @ not get removed from the core in time for 0.10? Or did I just misunderstand what is actually happening?
You're correct in that @ has not yet entirely been removed from the core language, because some old vestiges of its use in the compiler itself (specifically the AST) have yet to be removed. In order to actually use them nowadays, though, you have to opt-in with an attribute in your source file, so it's not possible to use them without being explicit about it. And we're certainly not encouraging anyone to actually use them, which is why it's quite embarrassing that mentions of them managed (heh) to slip through in the tutorial.
kibwen already posted[1] more details about @ in Rust 0.10, but the short of it is, @ still exists but is gated behind a feature flag. Code that uses it is still being updated. The functionally equivalent replacement is std::gc::Gc, but you should consider std::rc::Rc for reference counting instead (which supports weak references).
Ah, that's a shame. I actually just mentioned the tutorial as an awesome resource in another comment.
Maybe my understanding of the Rust language isn't as good as I thought it was, as most of it comes from reading the tutorial and the related guides linked at the end.
I'm a big fan of high quality documentation, and I assumed since the current tutorial was so well written, it was being handled actively already. This is actually one area I would love to step up and help Rust with. I've previously gone so far as to read some of the compiler implementation, but my experience with programming languages is still stuck in the interpreters stage, so it didn't get very far.
The guys on #rust-internals are super nice and can help you a great deal if you are interested. But tbh, we really need more contributions with respect to documentation. Again #rust-internals can guide you if you are interested in lending a hand.
How much involvement did he have on the project?
Brendan's resignation as CEO will have no effect on Rust or Servo.
Many people at all levels of the organization are huge supporters of Rust, Servo, and Mozilla Research in general.
(The "mozilla" people (brson and pcwalton) are the people to listen to there.)
I've seen reference to using #[start] and #[no_std] but it wasn't clear with the latter just how much of "std" I'd be giving up? Hopefully that would mean just giving up task spawning and inter-task communication (ok), or would it be everything under the std namespace (not so ok)?
Making this easy would be an easy win to get Rust into active use incrementally. Rust would for example be able to do heavy lifting in computations with Python/Cython providing a web front end dispatcher.
If you'll only call into rust from a single C-created thread, you could start that thread through a shim that starts up the rust runtime. Rust code can then spawn its own threads in there and all of std might just work.
I believe you can also just start runtimes in each call into Rust. Obviously it won't be particularly efficient.
Would it be possible to lazily start libnative if a call into the runtime is made but there's none there, but then keep it running for that thread for subsequent calls?
[1]: http://static.rust-lang.org/doc/master/native/fn.run.html
#[no_std] means that no part of libstd would be provided. This is typically expected to be used by, say, kernel developers. libstd itself is statically linked (by default) into your built product, so if you want you can compile your Rust library and use it on a system that has never had Rust installed.
I'm on my phone, but if you look up the 'SprocketNES' edition of the Bay Area Rust Users Group, you can see wycats talk about the details.
C:\Users\swah>rustc first.rust
error: could not exec the linker `gcc`: file not found
error: aborting due to previous errorNot that that is a bad thing, just that if you've programmed in almost any imperative language you're fine reading that online book. I'd love to use rust to replace my C stuff in the future if possible once it stabilizes. But until then I am just popping back to that book every other even .N release to have a look-see at progress.
It's basically a tutorial for people coming from typeless, pointer-less dynamic languages, whereas the official Rust tutorial assumes familiarity with the concepts that a C (or C++, C#, Objective-C) developer would know
Hopefully I will have something better and more generic near the 1.0 release ;)
Plenty of people are suggesting Rust for Rubyists, which is a good resource. I personally found it too simple, which is not a reflection on the resource but instead what I was looking for. It is likely to be exactly what plenty of people are looking for.
I wanted to give some motivation for keeping on at the official tutorial. Some of its contents went over my head initially as well, but I read it again a couple of weeks later, and everything clicked into place. It's a really awesome guide to the language, and the links at the end to guides to various more specialized parts of the language are similarly awesome.
At some point (shortly after the 0.9 release?) one of the first examples stopped working with a then-current git build, so I stopped reading it and concentrated on the official tutorial more.
The language won't change a whole lot, but the libraries will.
I think that this depends on your expectations, I was quite disappointed to find that there isn't a clean way to make 'unit types' (second, millisecond, meters, etc) in Rust..
I wouldn't use Rust for anything but toy project..
Actually, there's this bit on Tuple Structs[1] in the tutorial:
> Types like this can be useful to differentiate between data that have the same underlying type but must be used in different ways.
struct Inches(int);
struct Centimeters(int);
[1] http://static.rust-lang.org/doc/master/tutorial.html#tuple-s...Does that mean ever, or just that it'll be stable for some time before people start considering a 2.0 to try and fix whatever warts are discovered from wider usage of 1.0+ ?
A 1.0 release of Rust is targeted for later this year. There will be at least one more minor version (0.11), and possibly more, before that point.
If so, that virtually guarantees some regret after it becomes stable and new users flood in with new use cases that need breaking changes to address in an optimal manner.
Edit: Perhaps I was too subtle. If you think rust is something that may meet your needs in the future, you should do future-you a favor and start using it now when there is still time to remove warts in a backwards incompatible way.
I can understand the desire for stability before wrapping your head around a new language (typestate..), but if you're interested in Rust then you either patiently watch from afar, or at some point you just jump in and live with the breaking changes.
Semver seems like a straightjacket at the discontinuity of 0.x->1.0 if you don't want to commit to significant velocity of major versions. Perhaps the thing to do is define a second pre-1.0 series at 0.99.x, where breaking changes are made deliberately and include a source rewriting tool where possible?
That's the kind of vague goal that people will keep using as an excuse for not focusing on stability, and providing a product that's actually usable.
When it comes to programming languages, it's dangerous for their implementors to not produce something that's seriously usable as soon as possible, even if it means accepting some imperfections in the early stable versions.
With each passing day, Rust becomes closer to being something like Perl 6: anticipated, probably useful, but never actually "ready" enough to be usable. While I'm more optimistic about Rust potentially having a far brighter future than Perl 6, the lack of stability does cause unease.
Yes, sometimes the language/lib changes and you have to go through and edit all of your existing code. You can stick with point releases to minimize this, but most likely you won't want to, because these breaking changes fix problems and annoyances!
If you take a look at these changes for 0.10, they make progress on the language itself, and leaving these things as-is to stabilize the language would have been a terrible mistake. There are more of these in the line (DST..), as there should be. IMHO, Rust will be "ready" when such changes stop creating real progress.
Having watched Rust for several years now, it has always been apparent that it isn't an overnight language. Despite the goal of being based on only existing research, getting new implementations of ideas right takes careful deliberation. A large part of language design is getting the core features to play well with one another in ways that make sense, and creating well-thought-out core libraries that properly implement standard abstractions. Every inconsistency and incompleteness at this stage will lead to constant (poor) reinvention of these concepts to achieve the missing capabilities, and a subsequent proliferation of ecosystem glue code to make the different implementations communicate. A large part of why dynamic languages can be so expressive is that their core abstractions contain enough indirection to add missing functionality in a backwards-compatible manner, but a close-to-the-metal language simply does not have that luxury.
https://github.com/mozilla/rust/issues?direction=asc&labels=...
If anything, that's yet another way to justify not getting a stable release out there. It's the old "We can't release yet, still have bugs to fix!" trap that catches many software development teams.
There will always be some issues, so insisting on a vague notion of "perfection" becomes far more harmful than just getting at least something out there than users can actually use.
The point of semver is to stick to a standard, instead of every project deviating from common practice in subtly incompatible ways.
Here's the issue for getting us to adhere to semver proper: https://github.com/mozilla/rust/issues/11396
Actually, since they are doing backwards incompatible changes in every release, this version would be more like 10.0.0.
They are deviating from semver for now, I hope they get on it properly for 1.0.0 and beyond.
It's just two numbers separated by a dot (major version number DOT minor version number).
Perhaps if we switched to using something like 0-10 or 0:10, people wouldn't expect any reference to . to mean a decimal number.