Announcing Rust 1.0
blog.rust-lang.org
blog.rust-lang.org
But as much work as it's been just to get to this point, the real struggle begins today. Months and years of brutal campaigning, compiler engineering, and careful language design lie ahead. If you've yet to take a look at Rust, please do, and report your findings so that we can better prioritize our efforts for the near future. If you like what you see, there's plenty of work to go around and a welcoming community should you decide to dig in and join us. And if you don't like what you see, that's fine too; Rust is not the language to end all languages! We're just here to make the world a little safer, however we can. Hopefully today is but the first page in that story. :)
rust-story builds on 1.0, though, so I think I'll be able to forgive you. ;^)
Congrats on the release!
Before that, so many sigils in Rust scared me and kept me from learning it. Rust still has a bit many sigils nowadays, but it's definitely cleaner than before!
I had just started seriously learning rust a few months before they started moving owned pointers into `std`.
So I felt somewhat betrayed by the removal of the sigils. It seemed like all the hard work I had spent learning the various pointer types would end up being useless!
Of course that fear was ungrounded. I very quickly came to understand that what I had actually spent time learning was ownership; and _that knowledge_ is still perfectly relevant, even today in rust 1.0.
All that was really changing was the removal of some arcane syntax which had only served as a stumbling block in my quest to learn Rust.
I always joke about this being "programmer Stockholm syndrome": When you've mastered something that's actually not good at all, don't want that time and effort to have been for nothing, and become a champion for crap. It happens a lot and usually unintentionally - the champion feels genuine joy about the intricacies of what they're pushing and just wants to share it with others. You can see this happening a lot around poorly thought-through and/or overly complex technologies.
This is why Rust's progressive trimming and slimming over the last 1-2 years has been really impressive and gratifying to watch - it really takes a lot to reevaluate and let go. Critics will point out that Rust still is plenty complex, of course, and I think that's healthy skepticism too.
There was also just a sense of "OK, I get what these things do, but when should I us an @ vs an ~ vs a & in my API", and now I feel like it's much more clear what you use the different reference types for.
Thank you ever so much for the hard work done by yourself and the rest of the Rust developer community. It has been an absolute pleasure seeing the language evolve, and now that it's hit 1.0, I look forward to the incredible opportunities it makes possible.
It takes great courage to go against the grain in terms of the core language (e.g. abandoning GC, M:N scheduling, etc. as core parts of the language), but the end result promises some truly exciting times. Thank you again and thank you also to you and the others for commenting here on HN despite the heavy criticism at times and being ever so helpful for those of us on IRC. It's been a fantastic ride and I look forward to it getting even better.
So, what I like to say is this: If you look at Rust by mission statement, it hasn't changed at all. If you look at it by feature list, it's a completely different beast.
The focus of Rust has always been a safe, fast, concurrent systems language. It just took a while to figure out exactly how we wanted to accomplish that goal.
If Rust fulfills it's mission statement, it might become widely adopted. While that's generally good, it also makes changes to the language hard, see C++.
So, let's hope you got the things right that you can't change without breaking compatibility.
There was a really great blog post about writing a Scheme implementation, including a GC: http://fitzgeraldnick.com/weblog/60/
https://news.ycombinator.com/item?id=9541138 (two days ago on HN) and its website: https://github.com/servo/servo
For what its worth Java had an even longer gestation period and it wasn't until Eric Schmidt declared that we had to have 1.0 in Bert Sutherland's desk by 1/1/95 or "else" did it actually get to that point.
I'm really excited to start trying it out in earnest.
This is a bit disconcerting though:
ls -lh
total 588K
-rwxrwxr-x 1 cmcmanis cmcmanis 8.4K May 15 13:02 hello_world
-rw-rw-r-- 1 cmcmanis cmcmanis 83 May 15 13:02 hello_world.c
-rwxrwxr-x 1 cmcmanis cmcmanis 565K May 15 13:01 main
-rw-rw-r-- 1 cmcmanis cmcmanis 42 May 15 13:01 main.rs
I'd love to write a safe embedded system in rust and that is going to mean much smaller footprint for a 'hello world' level of program :-) $ size hello
text data bss dec hex filename
1329045 25256 102376 1456677 163a25 hello
That's a stripped Go 1.4.2 hello world (1941480 bytes unstripped).(go here to address some other comments):
ls -s1h hello*
1.9M hellogo
4.0K hellogo.go
12K hellors
4.0K hellors.rs
rust-code: cat hellors.rs
fn main() {
println!("Hello, world!");
}
go-code: cat hellogo.go
package main
import "fmt"
func main() {
fmt.Println("Hello, world!");
}
Compilers: rustc --version
rustc 1.0.0-beta.3 (5241bf9c3 2015-04-25) (built 2015-04-25)
go version
go version go1.4 linux/amd64
Flags for rust (inspired by[1], which may or may not be similar to what
cargo build --release does...): rustc -o hellors -C prefer-dynamic -C opt-level=1 hellors.rs
[ed: to add: If I strip the binaries, hellors ends up at 5.8k, hellogo at 1.3M. I built hellogo with just: "go build hellogo.go" -- I'm not sure if there are any flags that would make sense? ][1] https://github.com/rust-lang/cargo/blob/c874e37fbe195e86d6dc...
Would using naked println be similar to using putc in C?
Anyway, just tested, and stripped a version without fmt is 414k.
But realistically anything more complex than hello world is going to be at least a few MB in go, and eventually you might have to use fmt.Println() and most production code probably does.
Edit: and yes fmt.Println() is idiomatic. I was just mentioning that it is possible for helloworld to be a bit smaller in go than other go programs.
[0] http://golang.org/src/builtin/builtin.go?s=10600:10626#L240
I just found out that my rustc-arguments probably were wrong (for most uses, anyway). Or rather, they link dynamically to the rust standard library -- which while "equal" to C, won't hold most of the time. All (non-embedded) systems will have libc for the foreseeable future -- assuming that they have rust libstd is probably not a good assumption to make.
I found this out after I upgraded to rust-1.0, and the lib/libstd-<hash?>.so files changed names.
So while:
rustc -O -C prefer-dynamic -o hello hello.rs
works, that produces a really dynamically linked little binary. One probably wants: rustc -O -o hello hello.rs
This statically compiles in the rust std lib, and leaves a binary that's ~332k after stripping.(Btw, -O is equivalent to -C opt-level=2)
If I could, make a little suggestion?
Focus on building a community around the language, the way Go did, which was masterfully executed:
Newsgroups, conferences, videos, tutorials, more videos, talks, speeches, more tutorials, books, articles, blogs, docs. All of that, churning non-stop.
It's tedious. It's just as much effort as the language itself. I realize that. But it's truly why I even bothered with Go, which is, IMO, arguably a not-as-exciting language as Rust, yet already has amazing library/community involvement and support.
(Also: these things already happen to a degree, and I hope they start happening even more now that 1.0 is out!)
I'd also like to think it will be a bit less difficult for Mozilla to accomplish this because, well, Mozilla's values inspire loyalty, even love in my case, I love Mozilla.
That is a GTK GUI application that makes HTTP requests in under 40 lines of code.
Don't get me wrong I love all the safety gaurentes and what not, but just being able to write quick simple apps that would usually be a pain to write in C is a game changer for me. A lot of this is down to Cargo (the Rust package manager, very npm-like imo) and all the great rust libraries that already exist. I'm super excited to see where this goes now that it's 1.0, people can stop worrying about breaking changes in the language and just get down to writing libraries to do everything.
This is how Mac apps tend to be fast: the high-level application logic is reference-counted and uses relatively slow Objective-C dynamic method calls, but things that are performance critical (CoreGraphics, VideoToolbox/AudioCodec, OpenGL, sqlite, the Mach kernel) are written in C and C++.
If it does than I would disagree - not many other native languages can do that - having a native language with a sane build system, package management and proper modules would be a huge deal on it's own.
You might want to add a CC0 license to the project (or something else, but that's usually what I see recommended for "sample code").
[ed: and:
ldd ./target/release/hello_gtk |wc -l
59
]I really don't mean the downplay all the safety stuff, that is the main reason that I'm interested in rust. I just don't feel like the fact that you can do things so easily in rust gets enough attention.
My biggest "Oh my god, that was awesome!" moment was when I first built the project and Cargo just took care of the whole dependency tree and I never even had to think about it. I've never had that in a low level language before. I've actually been stepping out of a lot of the C that I've been doing into doing more with JS just because NPM makes it so damn easy to whip something up. I'm hopeful that rust will let me come back to a much lower level where a 10MB binary is really large.
It's exciting that you can have power, portability and speed competitive with C, but with syntax and safety so good that you're comparing them to Python :)
I think its a mistake to view any language as simply a 1:1 replacement for an existing language. Newer languages can have the greatest strength in an area currently dominated by one older language (say, Rust with C), and still be better for some applications where another older language would generally be preferred to the first (say, Rust being better than Python at some things where Python would generally be preferred over C.)
Allow me to ask some questions, because I cannot easily find the answers and they're IMHO crucial for wider Rust adoption:
1. What CPU architectures/platforms Rust currently supports?
2. What's the state of cross-compilation support?
Most of devs have workstation on i386/amd64, but some of us may work with ARM, PowerPC and other architectures. Rust's memory safety seems appealing for embedded solutions, but can it be used there already?
BTW The install page is not well-thought-out.
http://www.rust-lang.org/install.html
Unless I hover on the 32-bit/64-bit links and read addresses they point to, there's no way to tell whether it's for x86 or ARM for instance. And installation via piping script that is being downloaded to shell is something that shouldn't be present at all.
2. Exists, but isn't particuarly easy. The biggest hurdle is getting a copy of the standard library for the target platform, then it's pretty easy. It's gonna be a focus in the near-term.
EDIT:
Quick googling revealed that Rust doesn't work with musl libc yet. It will be really nice when it will be fixed.
Making this work well is a very high priority.
There's a community member that keeps the iOS build green, I forget which ARM that is.
The official tested support is for V7-A, but V6 support also is in tree.
The alternative is you download a binary and run it, at which point that binary can do whatever the shell script could have done.
(The other alternative is you download source, at which point the Makefile or any other piece of the build that you execute can do whatever the shell script would have done.)
As long as the script is available via https the security is equivalent to the alternatives.
Part of the problem with this is that since it's a bootstrapped compiler, and the only one for the language so far, "downloading source" mean you need a binary to compile it with, which devolves to the same problem.
I've still thought about doing it.
I'm finally going to get some real sleep tonight, I think.
Rust is going to be the first time I am going to learn a programming language from the day it is born (until now it was tough to learn Rust, given the changing APIs ;).
I see a bright future for Rust. Thanks to Mozilla and the whole community for making it possible.
Hehe, we didn't choose it for any specific reason, but when we started to do the six-week cycle, it landed on a Friday. I like shipping on Friday for a number of reasons, but there's good reason to pick any particular day.
Wish the problems would come with a sample datasets though
For example, the first problem "gloves" says you have a limit of 1024mb memory, 2s runtime, 100,000 max dataset size
How are you supposed to test that, without going through the motions of generating the data yourself?
EDIT: I do realise you're supposed to use the online editor thing and submit the answers to your server for the code to be judged, but I loathe writing code in my browser, would be nice to test offline in my own editor!
What's the plan on those fronts if they won't be in 1.0?
There are already crates that offer some of this, like mio.
The end user doesn't really care. The line between the standard library and the language is usually invisible.
It often is a language concern: no async/await in the compiler or language-assisted yielding/scheduling means difficult or impossible concurrency model.
With Rust's borrow checker, IO (already unsafe C FFI) + callbacks are hard to write in a pleasing and safe way.
There's work on non-blocking IO at https://github.com/carllerche/mio, which is looking like one of the more promising approaches, as well as https://github.com/carllerche/eventual which provides higher-level abstractions over it.
There has been some discussion of adding some language support for something like async/await/yield from other languages, but nothing concrete in the near future on the language front.
So, there's usable third-party libraries for it (at least, if you're on a Unix like platform), language support is in the realm of "it would be nice someday".
My remembering is that it uses a different LLVM version than we use, which is very cutting-edge. So we need them to update before it works well.
A reason why I would choose Rust possibly is because you can prevent data races although with it's memory management model.
- Performance is important even for web applications. For example, after migrating to HHVM, Wikipedia could buy less servers, serve pages faster, and reduce latency.[1] Rust is fast, even compared to other statically compiled languages.
- Safety is also good to have for web development. I personally find it difficult to refactor my Python web applications. This isn't necessarily an advantage of Rust solely, statically typed languages tend to have this property more or less. But Rust does provide more guarantees than ordinary languages do.
[1] http://blog.wikimedia.org/2014/12/29/how-we-made-editing-wik...
The I/O libraries have more work to be done (mostly for the async story), but they're ok for now and the plans I can see look promising. I see a bright future for those of us who like to write robust and high performing API servers, so don't shy away from Rust in that domain!
EDIT: Forgot to say that everyone's very friendly in #rust-webdev where Hyper/Iron authors and others can be found.
It seems to me that the borrow checker disallows behavior that I (perhaps naively) wouldn't be concerned about. For example, if I have this C snippet:
{ // Safe C
int *ptr = NULL;
int val = 42;
ptr = &val;
}
Everything is hunky-dory. Translating this to Rust results in this (I think): { // Malformed Rust
let ref: &i32;
let val = 42;
ref = &val;
}
Now the borrow checker tells me that "val" doesn't live long enough, because the reference comes to life before the value. It seems like this should be safe behavior, because the reference isn't bound to the value until after the value comes to life.Can anyone shed some light on this for me? I'm all for safety, but this in particular seems like something that I should be allowed to do.
But what happens is that variables leave scope in reverse of the order in which they came in, so ref lives for slightly longer than val.
This happens so that the order of destructors can be guaranteed.
I did, thanks.
This happens because borrow scopes are always lexical. This is a bug, see https://github.com/rust-lang/rfcs/issues/811.
In this case, I think the term is justified.
Your ref can't be unassigned. There are no null pointers.
let x: i32;
But you have to assign to it before you can use it.> That would leave 'ref' dangling, if even for a moment, like here. That'd be bad.
I'm not sure I agree that it would be bad (except maybe from a purity standpoint). Ref is unreachable during the time it is "pointing" to the out-of-scope "val", so nothing can actually reach the out-of-scope value through ref.
You can argue that it would be easier if it just made this work, but at the same time, there would be more special cases. Right now, the rule is very simple.
We'll see once SEME regions and or non-lexical borrows land, though...
I can't help but feel the language has a very steep learning curve, however; doing something like making an event-queue-with-callbacks is very hard to write out in Rust if you're a beginner with just the current docs.
I think Rust will benefit greatly if their docs compiled some articles on how to write typical systems-related code (for me, I would love to see how to implement task queues with callback mechanisms).
Edit: looks like I'm going crazy. It seemed so vivid too like I actually started checking out the rust documentation and was looking for a book to pick up. Unless everyone is messing with me...
Um.......yes? Crap.
It's also one of the few open source projects that has actually gotten me to contribute.
And yeah, there's certainly a ton of weak points. We landed a _lot_ of Rustdoc fixes that make certain things better, but there's still a ton more to write. I've been mostly focusing on the longform docs. I just wanted to make sure that I know where people are having problems, so I can know where to focus my efforts. Thanks.
The book is in the "trpl" directory: https://github.com/rust-lang/rust/tree/master/src/doc/trpl
The standard library docs are maintained in doc comments in the appropriate places in the source: https://github.com/rust-lang/rust/tree/master/src/libstd
You can clone the repository, modify it locally, and build and test the docs (yes, the docs get tested, most of the code samples are actually executable tests), or you can just edit them online in GitHub's editor and send a pull request that way if you're just making documentation suggestions that won't need any tests.
Some way to conflate the two types of docs might be cool. For example, if there were high-level examples of commonly used API patterns in the std lib ("we use traits in this fashion here to achieve the following goals"), the docs could embed links to them as factoids ("this is an application of <this pattern>"). Heck, even just a ? button next to the "Traits" header linking to the book's Traits section would probably help some folks.
Linking to rust-guidelines in some way to back up the design of various APIs might be cool, too.
(Don't want to be the guy to crash Happy Day with more requests, so I'll just add: Many thanks for all your work, Rust has been tickling my brain in enjoyable ways like nothing else this year.)
Oh, and rust-guidelines actually moved in tree: http://doc.rust-lang.org/stable/style/ They haven't yet been linked because of all the FIXMEs.
Thanks for the suggestions. :)
ASCIIDoc or something else might be nice too.
I do like the homepage for its simplicity, but no-one would know the significance without digging into the 'community' links. If that doesn't seem like an issue, then nevermind. Just a thought.
edit to explain: I'm at work and can't hop into IRC to chat about it.
Some of the hardest parts of the documentation is the functionality hidden behind `impl SomeTrait for SomeStruct`. Eg. `impl PartialOrd for BTreeMap`. What on earth does that do? Or the fact you're meant to make a randomly seeded `ChaChaRng` with `OsRng::new().unwrap().gen()`, which is genius but impossible to guess.
Those implementations should absolutely be in the generated documentation, can you maybe point me to some specific pages? Thanks :)
https://doc.rust-lang.org/collections/struct.BTreeMap.html
https://doc.rust-lang.org/collections/vec_map/struct.VecMap....
ChaChaRng is
http://doc.rust-lang.org/rand/rand/chacha/struct.ChaChaRng.h...
although the other implementations also need this. The main page for rand should probably have this somewhere on it, too.
Thanks for helping :).
ChaChaRng _does_ mention OsRng, but a code sample might help, for sure.
I know what a partial order is, I just don't know what partial order maps realize. In Python they aren't orderable.
> ChaChaRng _does_ mention OsRng
It says to use OsRng if cryptographic security is needed, not how to seed with it.
The obvious way is something like
let osrng = OsRng::new().unwrap();
let mut key = [0u32; 8];
for word in key.iter_mut() {
*word = osrng.gen();
}
let prng = ChaChaRng::from_seed(&key[..])
which is a pain.Thank you for taking the time to spell it out to me.
iter::order::cmp(self.iter(), other.iter())
works as an ordering.HashMap in Rust (dict in Python) doesn't have a canonical ordering of elements, so this doesn't make sense.
EDIT: To answer my own question: http://killercup.github.io/trpl-ebook/
No more "cargo clean; cargo update; cargo build; cargo test;" every day! At last.
github.com/pwoolcoc/cargo-do
IF you're curious, the relevant code is at https://github.com/krzysz00/rust-kernel/blob/master/kernel/m... . The functions that start with "rust_" are the allocator interface
F' as u8
is equivalent to b'F'
, and ['F' as u8, 'R' as u8, 'E' as u8, 'E' as u8]
is equivalent to *b"FREE"
which definitely is a lot more concise :). These are called byte string literals.Edit: The dereference is necessary because b"FREE" on its own has the type &[u8; 4].
(Cough.)
The purist REST crowd also has used "RESTafarian" for years, and they're almost indistinguishable when spoken...
On the other hand, I can't imagine there are many rastafarians lurking on tumblr.
I don't think we currently have a changelog or anything: we were mostly focusing on this new, stable branch this time around. You're right that making a changelog now would be super helpful, I'll add that to the list for next release. Thanks!
Personally - "val and var" are more intuitive.
let (mut a, b) = (..., ...); // a is mutable; b is notIf the whole point is to name a memory address - mutable or immutable. Why not have a special name for the address itself ?
e.g: a = immutable, #a = mutable.
I should design an "uber-lang" to sit on top of JVM / CLR / LuaJIT / Rust ! :)
I'm glad they didn't give it a special prefix because not only would it add unnecessary noise, it would make refactoring tedious. I'd rather give the compiler my intent once, and let it figure out if I violated my own intentions.
One thing I like in the F# toolset is the syntax highlighters will highlight mutable and reference variables different colors. It's a matter of time before Rust developers have that (If they don't already).
Thanks !
Is it packaging a lot of extras that aren't needed for such a simple program?
$ cat helloworld.cpp
#include <iostream>
int main() {
std::cout << "Hello world" << std::endl;
}
$ g++ -std=c++14 -Os -static helloworld.cpp
$ size a.out
text data bss dec hex filename
1294232 29692 92936 1416860 159e9c a.out
The majority of this is bloat from GNU libc though, using diet libc would yield better results $ cat helloworld.c
#include <stdio.h>
int main() {
puts ("Hello world");
}
$ gcc -std=c99 -Os -static helloworld.c
$ size a.out
text data bss dec hex filename
725706 7572 9080 742358 b53d6 a.outEdit: You made my point for me in your edit :) Leaving my original comment for posterity.
Yes, a simple "Hello World" winds up statically linking a fairly sizeable standard library, in particular anything dealing with strings has to involve a certain amount of UTF-8 manipulation and the formatting and I/O have a lot of features and thus likely fairly large code size. But for the most part that's just fixed overhead, and you can opt out of using the standard library if you want and produce smaller executables.
If you want tiny binaries using dynamic linking then you can use "rustc -C prefer-dynamic".
I'm happy it does static linking by default because like you said hard drives are cheap and it's safer.
I haven't followed Rust much, but as a total n00b: what are some practical reasons why one would choose to learn Rust? What features does this language have which others (pick: C, C++, D, etc.) don't have? What does it do better than the aforementioned languages? (Please don't take these as a challenge, but as a desire to learn more). Thanks!
The shortest answer is 'memory safety without garbage collection.' C and C++ don't have 1, D doesn't have 2. D is working on 2, but then it won't have 1.
Secondary reasons: newer, better, more standard tooling, (in some cases, not others: IDE support, not nearly as good. Build system and sharing code? Way better.) Similar concepts in a more orthogonal package. Lack of legacy baggage. Easier (hopefully) for non-systems programmers to get into, as the compiler is there to help. It really depends.
Reasons those languages are better than Rust: adoption, ubiquity, more tutorials and a bigger community.
It sounds like this:
Rust is a systems programming language focused on three goals: safety, speed, and concurrency. It maintains these goals without having a garbage collector, making it a useful language for a number of use cases other languages aren’t good at: embedding in other languages, programs with specific space and time requirements, and writing low-level code, like device drivers and operating systems. It improves on current languages targeting this space by having a number of compile-time safety checks that produce no runtime overhead, while eliminating all data races. Rust also aims to achieve ‘zero-cost abstractions’ even though some of these abstractions feel like those of a high-level language. Even then, Rust still allows precise control like a low-level language would.
The one everyone mentions is that Rust gets memory safety without garbage collection. But there are cooler things, like being able to implement units in the type system. Rust also gets safety right in the sense that its defaults are good - its primary random number library has ChaChaRng and IsaacRng instead of a Mersenne Twister, for example.
The sensible library design goes everywhere, from Rust's functional roots, high-quality zero-overhead iteration protocol (none of the mess that C++ gives you) to simple things like a well-designed composable hashing standard.
Even stuff like comparing C++'s move, copy and constructor semantics are much nicer in Rust, and in most cases even lower overhead: everything is a memcpy and is implemented automatically.
I can go on. Rust is one of the few languages that IMHO gets string handling right, and has good unicode support from the outset. It's easier to write error-proof filesystem code than any other language I've used. Threading isn't a mess.
There are disadvantages, such as Rust being one of the hardest languages to learn. Generics are both pervasive and difficult - they're clean unlike in C++ but they're also uncomfortably explicit. There are lots of nonlocal typesystem effects, largely due to the thirst for safety.
But it's a good language. Definitely one of the most exciting I've seen in a while.
Maybe it's because I'm used to it, but do you have an example of why you think this? I think with type inference being pervasive, I've never been annoyed by generics. Additionally with type aliases a lot of pain can be avoided.
One of the ugly parts is that call-site type parameters, when given explicitly, have an ugly (but consistent) syntax. This is probably unfixable. Another annoying part is the lack of anonymous return types, which makes some types annoying to read or even impossible to express, but work is being done to improve this now.
https://github.com/rust-lang/rfcs/pull/105#issuecomment-6410...
?
Type inference does make such things easy inside function bodies, but there are a lot of functions so it's not a complete solution.
Even some of the uncomposed iterator signatures are uncomfortable. An example:
fn partition<B, F>(self, mut f: F) -> (B, B) where
Self: Sized,
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> bool
D gives you Range partition(alias predicate, SwapStrategy ss = SwapStrategy.unstable, Range)(Range r)
if ((ss == SwapStrategy.stable && isRandomAccessRange!(Range))
|| (ss != SwapStrategy.stable && isForwardRange!(Range)))
which, if changed to only support stable partitions (like Rust), would be Range partition(alias predicate, Range)(Range r)
if (isRandomAccessRange!(Range))
Note that I'm _not_ saying D's solution is better. I'm saying I find it more comfortable.Out of curiosity, impossible to express how? Can't one just store the return value in a variable, investigate its type, then copy-paste that as the function return type?
At the moment I think closures are impossible to express as named types.
A few examples just off the top of my head: the language doesn't hide performance tradeoffs, namespacing makes sense, "zero-cost abstractions" are beautiful and common through the ecosystem, cargo is a wonderful tool for building, creating docs, testing, etc. I've had a lot of fun using Rust to build things I really didn't need it for.
It's a breaking change, but who would mind?
I also hope they are not too conservative in the beginning, because we might have to pay for mistakes for a long time.
Can you give us some information on that?
One of the many great things about Python (and other "dynamic" languages) is how flexible it is in so many ways. Instead of forcing you to be more explicit, make more decisions, and lock more things down in advance, it lets you get away with telling it to figure out a lot of things for itself while the program is running.
This kind of flexibility isn't free. It does a lot of things indirectly, it makes decisions for you and, if they turn out to need changing, it makes those changes as, and so on, while it is running, which requires a lot of computation.
You actually could compile Python, but keeping the "exact syntax" presumably means keeping all of Python's capabilities to be flexible at runtime, so compiling would require essentially building a lot of the Python interpreter right into your compiled app. This, in itself, would just change the packaging and wouldn't buy you much in terms of performance. A lot of clever people are looking for ways to speed up Python without removing features, but it will probably never be possible to make Python as fast as Rust will eventually be, nor to make Rust as convenient as Python.
But like mentioned, there is Nim. Which at least have the indentation-thing going for it.
I set --prefix=/usr --enable-debug
No dice. I also tried to build from source in a VM on that same machine. 32-bit Ubuntu 14.04.2 (3GB of RAM), latest stable toolchain. Again, didn't compile. Core dump.
It would probably be best to carry on a conversation on a formal bug report; did you file one at the url it listed?
[1] https://github.com/phildawes/racer [2] https://github.com/Valloric/YouCompleteMe/issues/1297
I haven't given it a try, but it looks as it provides basic functionality. Since Rust is such a young language, I don't really expect much until at least a few months have passed. We will probably start seeing plugins for Eclipse and other big IDEs in some time.
It would be useful for people new to Rust to see what existing libraries are available and one way would be to have a link on the www.rust-lang.org site's font page pointing to crates.io site.
There's lots of stuff that we build, and we say things like, "Language X is slow, but it doesn't matter." "Language Y uses a lot of memory, but it doesn't matter." This is very, very often true. But every once in a while, it really matters.
That's when you want something like Rust. When the details are important. When you need full control, but you'd like a compiler to help catch your mistakes. When a garbage collector has too much overhead. When you need to write something inside of Language X or Y, instead of a C extension, you can use Rust.
Basically, anywhere you'd use C or C++, Rust is a great fit. Elsewhere? Maybe, maybe not. Depends.
Are there any examples/discussion/information for interacting with rust from python, like you would a C extension?
A Ruby gem in Rust was one of our earliest production uses.
Rust is a systems programming language that runs blazingly fast,
prevents nearly all segfaults, and guarantees thread safety.[1]
So, if you care for low memory usage, execution speed or safety guarantees especially for hard-to-debug kind of errors, then Rust might be interesting for you.It offers low-level access like C or C++ but excels with vastly improved security. So, I'd take that step, and say that where C or C++ is used right now, you might want to use Rust in the future.
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...
or go:
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...
Here's what it's not as 'blazingly fast' as:
http://benchmarksgame.alioth.debian.org/u64q/compare.php?lan...
Just trying to dismiss measurements that are publically available, without putting forward something you consider better, is kind-of…
The expectation that has been created is - "Rust is a systems programming language that runs blazingly fast" - and that may lead to disappointment.
That's all. No reference to "a particular benchmark", or whatever you take "generally fast" to mean.
The Rust language offers low-level access with amazing security guarantees, and is working on an optimizing toolchain.
Let me take Python as a comparison. It has fundamental[1] roadblocks for being fast on current and probably future hardware, because its dynamic nature requires many indirections which are problematic for CPU cache efficiency.
Will Rust always be faster than C? Probably not, but that is not needed to be blazingly fast. What is important is that there are no fundamental difficulties to be as fast as C.
[1] I know, you can work around some of those indirections.
(By 'always' did you mean 'ever'?)
That may be so, but their advertising gives the wrong impression. They should keep their claims muted until they can back them up.