8 ms·
Rust 0.5 released
- kibwen 14y ago0.5 was a rather smaller release than previous ones, due to Niko being distracted by RiverTrail[1] and ParallelJS[2] and Graydon being distracted by setting up the new Buildbot infrastructure as well as relicensing the compiler.[3] There have been some big changes (most for the better, IMO), but there's still a rather lot of half-finished things floating around. All the same caveats of past releases apply: work in progress; use at your own risk; the language will continue to change; code that you write now will break in subsequent releases. 0.6 should be a rather exciting cycle though. I'm hopeful that a lot of the semantic cleanup will be more-or-less complete. Also, they're getting a new but temporary full-time developer in the form of John Clements,[4] who's taking a sabbatical from his university position to work on Rust. [1] https://github.com/RiverTrail/RiverTrail/wiki https://github.com/RiverTrail/RiverTrail/wiki [2] http://smallcultfollowing.com/babysteps/blog/2012/12/05/self-hosted-parallel-js/ http://smallcultfollowing.com/babysteps/blog/2012/12/05/self... [3] http://thread.gmane.org/gmane.comp.lang.rust.devel/2593 http://thread.gmane.org/gmane.comp.lang.rust.devel/2593 [4] http://www.brinckerhoff.org/clements/ http://www.brinckerhoff.org/clements/
- pcwalton 14y ago"code that you write now will break in subsequent releases." It's not that bad; we're trying to be mostly backwards compatible from here on out. I was hoping that 0.5 would be the backwards-compatible release; it's not, mostly due to the name resolution changes that still aren't done, but it's close. It should not be much work to upgrade your code from 0.5 to 0.6, much less than 0.3 to 0.4 or 0.4 to 0.5.
- kodablah 14y agoYay, item macros. Means top-level elements can now dynamically created. Also another big change is "auto-move" where you don't have to write move everywhere. Also the repl is nice. I think having this and having Rust bootstrapped give it a leg up on Go.
- swah 14y agoI was not aware Rust had macros. Does that mean one can write lispy things like the "with-*" macros ? Sorry, I'm afraid I'm confessing my affair with Emacs but I swore I'd leave her behind...
- kibwen 14y agoRust's macros are generally Scheme-like (macro-by-example), although it's not exactly the same since Rust obviously doesn't use S-expressions. See http://static.rust-lang.org/doc/0.5/tutorial-macros.html http://static.rust-lang.org/doc/0.5/tutorial-macros.html for a little more info on Rust's macros system.
- pnathan 14y agoI've really become quite a Rust fanboy, although I haven't written tons of code in it. IMO, it's considerably more accessible than Haskell or a ML-family. I'm not precisely sure why, but it seems to "make sense" in a very straightforward way. Some of it I think is lessons-learned from older languages, some of it might be the syntax, some of it just might be mental fit. Certainly - and this is a huge deal - I could realistically see using Rust in an enterprise scenario where we don't null pointer exceptions but we do want type safety yet we don't want to buy into Java or go full functional programmer with Haskell. Of course that's a few years out, but, but but! That's cool! I look forward to using this latest version and working away on writing Rust at home. :-)
- chimeracoder 14y ago> I've really become quite a Rust fanboy, although I haven't written tons of code in it. As someone who's been meaning to try it out for a while, I have a couple of questions for you. First, how did you get started? I found the tutorial decent, but after reading through it, I didn't feel like I could quite jump in and start writing code. By contrast, I never actually read the Go spec/tutorials; I did a brief run through the sample web application and was able to write everything else right away (filling in from the documentation as needed, of course). Second, how did you come to understand the memory model? I consider myself more familiar in both functional programming and memory management than average, but I found the memory model to be a bit of a conceptual hurdle (even though I'm attracted to the approach on a philosophical level). Having such a unique memory model makes it a little tough to simply get started writing code right away. Finally, how do you find the libraries in different areas? Web applications? Scientific computation? This isn't really an across-the-board question, since certain areas will probably be more complete than others, but what kind of applications are currently easiest to write in Rust when getting started? EDIT: I understand they're different languages with different goals, but I'm comparing everything to Go just because they're both emerging languages that I started to try to pick up around the same time. I found Go much easier to get going with (no pun intended), but I'm looking to catch up with Rust as well.
- kodablah 14y ago
- jeremyjh 14y agoReally glad to see the REPL!
- espadrine 14y agoI wonder whether anyone here knows how it is meant to work. All my inputs fail with the following message: > rust: task failed at 'no mode for lval', /home/tyl/files/cloud/rust/rust-0.5/src/librustc/middle/liveness.rs:1573
- pcwalton 14y agoJust fixed this. I'll see if we can push out a Rust 0.5.1.
- espadrine 14y agoYay! Thanks ☺ This can, incidentally, be a great start for a tool like Why the Lucky Stiff's "Try Ruby in Your Browser" [1]. s/Ruby/Rust/ [1]: http://tryruby.org
- kibwen 14y agoIncidentally to your incidentalism, I'm looking forward to the day when we can run Rust directly in a browser via Emscripten: https://github.com/mozilla/rust/issues/2235 https://github.com/mozilla/rust/issues/2235
- espadrine 14y agoHave you stopped using git tags for releases? (I haven't updated the repo in quite a while, and `git tag` gives me all releases up to 0.3.)
- nightpool 14y agoGithub still seems to show tags on the releases: https://github.com/mozilla/rust/tags https://github.com/mozilla/rust/tags
- dkhenry 14y agoI think once rust stabilizes a little more, its going to be a excellent language. The real big thing is going to be stand alone rust programs. I know they have two tickets open ,but I would love to be able to write rust programs that don't require the core library to run.
- tree_of_item 14y agoDo you still need to compile all of LLVM? I tried to install Rust a few days ago and came back to my computer using gigabytes of swap space, which I assume is due to LLVM.
- kibwen 14y agoYeah, for the moment it still uses a custom LLVM, so the first compile is still a pain (though LLVM does build in parallel really well with -j8). I really hope that the Rust devs make it a priority to upstream their LLVM customizations, especially if they hope to be pegged to a stable LLVM release by Rust 1.0.
- minhajuddin 14y agoHow is rust compared to Go?
- kibwen 14y agoRust and Go may be superficially similar, but they are night and day semantically. They're also aimed at different niches and have wildly different goals. So though it may be tempting to compare the two, it's not an especially productive exercise. :) This town is more than big enough for the two of them.
- SiVal 14y agoIt seems to me that any answer that stated specifically what those different niches and wildly different goals actually were would be a more productive exercise. If there's room for more than one of them in this town, in which part of town would each reside?
- samth 14y agoDisclaimer: I'm not a Rust developer. One way to think about this is that if you want to implement GitHub, use Go; if you want to implement git, use Rust.
- mbrubeck 14y ago[Disclaimer: I've written only a tiny amount of Rust code, and no real Go code. I work for Mozilla but not on the Rust team.] From what I've seen Go is designed with emphasis on ease of programming, performance, and concurrency; Rust is designed with emphasis on safety, performance, and concurrency. (Of course these are broad generalizations, and neither language is limited to only these concerns.) Go is a simpler language in various ways. Rust provides more control over things like memory management but at the cost of some added complexity (e.g. multiple pointer types). Rust provides some abstraction/expressivity features that Go lacks (like parametric/generic types, macros, and algebraic datatypes), again at the cost of some added complexity. Rust makes more static safety guarantees (for example, no null or "nil" pointers). While the compiler provides many of these guarantees without creating extra work for the programmer, sometimes you do have to structure or annotate your code in a particular way so the compiler can prove its safety. Of course the two languages are also similar in many ways. For example their syntaxes are in the C family; they compile to native code; they provide CSP-style concurrency; they have some amount of local type inference; and they do not use inheritance as the main style of composition. Rust's safety features should make it ideal for writing security- or stability-critical code. Go's simplicity probably makes it faster to learn and better for rapid development, especially for programmers used to dynamic languages like Python or JavaScript. Rust's expressive power might provide more options for abstracting common patterns out of large codebases, or to provide libraries that extend the language in different ways (e.g. using macros). Go is more mature than Rust at the moment and has more libraries and a larger community. Rust has first-class support for code that does not use garbage collection, which can make it more suitable for certain types of systems programming.
- iso-8859-1 14y agoWhere can I find binaries for 32-bit Ubuntu 12.10? Or a VM image? Will the Windows binary work in Wine?
- kibwen 14y agoA volunteer usually comes along with PPAs within a week or so, though with the new buildbot it might be feasible to have official nightly binaries built for every platform. The Windows builds are very finicky, I'd be quite surprised if they worked under Wine.
- mcpherrinm 14y agoYou can grab 64-bit linux binaries compiled on Debian from http://mcpherrin.ca/code/mozilla/rust-0.5-binary.tar.bz2 http://mcpherrin.ca/code/mozilla/rust-0.5-binary.tar.bz2 I don't know if that's helpful for you. I'll look into packaging stuff too.
- thomaslee 14y agoHuge congrats guys! I admit I'm still trying to figure out the nuances, but I really like a lot of the ideas in the language. :)
- Direct 14y agoI'm a little rusty but I did read the 0.4 docs before and gave the language a try, I'll dive into 0.5 again this weekend, I am a little confused by something however. What's going on with strings? When I last looked, a lot of the string operations worked with a specific pointer sigil[1]. If I'm using managed boxes, and the methods take and return unique boxes, is it because I'm using the wrong sigil for the job or should I expect to be able to use managed strings? Is this just me misunderstanding the memory model or is this something that just hasn't been straightened our yet? I'm pretty confused about this in particular, as I thought I understood the point of the different sigils pretty well, but the way the library is written makes me wonder. This applies to things other than strings I guess, but strings seem like a good example. [1]: https://github.com/mozilla/rust/blob/master/src/libcore/str.rs#L197 https://github.com/mozilla/rust/blob/master/src/libcore/str....
- brson 14y agoIt's not your misunderstanding, there is just very little library suport for managed vectors (and strings). For quite a while managed vectors did not exist, so owned vectors are everywhere. The semantics of managed vectors and owned vectors are quite different and unifying the library code so that managed vectors are more accessible will be a challenge. It is a widely-felt problem though and some folks have ideas for solutions. For now, it is best to use owned vectors, but there are two modules, `core::at_vec` and `core::at_str` that can help you if you need them.
- Direct 14y agoAh ok, brilliant. This was my main reason for not trying to play with Rust a little more. I thought it was something I just didn't understand. Just out of interest, is there anywhere I can have a look to see what kind of solutions have been suggested?
- nullc 14y agoI'd hoped that rust would have a lot of powerful tools for typing and exposing invariants and contracts— tools to help create provably reliable software. As sexy as new programming tools are, the big problem in software today is that we simply can't manage the complexity of it and as a result _everything_ is full of bugs and unintended behavior. Addon layers like ACSL are hard to use and messy because they work at odds with the language, instead, e.g. of being integrated with the typesystem. I was hopeful that rust could really advance the art here in the context of practically usable systems (vs academic toys) and I suppose it does, but it also lost features for formal analysis between versions and as its now becoming stable I suppose they won't return.
- pcwalton 14y agoI assume you're referring to typestate. One of the reasons that typestate was removed is that practically everything you can do with typestate can be done with session types instead. Constraints can be modeled as unique types with a trusted transition function from state to state. The unique type system used for memory management in Rust nicely doubles as a session type system. This is actually done today with the pipes compiler—it uses unique types to statically ensure that you can't violate a communications protocol, just as typestate can. One of our focuses for 1.0 is on aggressively pruning features that overlap, to reduce language complexity and to avoid committing ourselves to language features we might not need. However, future versions of the language might add more static analyses as they prove useful.
- doublec 14y agoDo you have any code examples of where this is used that I can look at? Like nullc my interest is in the area of types being used to enforce contracts and safetly (hence my interest in the ATS language). Typesafe was my initial interest in Rust and I'd love to see examples of how this is being approached in Rust as it is now.
- pcwalton 14y agoProbably the best place to look at the moment is this presentation: https://air.mozilla.org/intern-presentation-message-passing-in-rust/ https://air.mozilla.org/intern-presentation-message-passing-...
- ExpiredLink 14y agoWhat is the intended audience for this language? "[Rust] supports a mixture of imperative procedural, concurrent actor, object-oriented and pure functional styles. Rust also supports generic programming and metaprogramming, in both static and dynamic styles." IMO, Rust tries too much (norrowed pointers, managed boxes, owned closures, ...). I am convinced that the language(s) of the future will be simple and safe.
- ufo 14y agoIf I understand correctly, they are aiming at things that usualy get built with C++ nowadays. Its hard to get a sinple and elegant language here because a big part of the appeal is having very tight control over memory layout, execution order, etc.