7 ms·
Why is Rust interesting?
by anon110 13y ago
Why is Rust interesting?
- zellyn 13y agoC++, programmed well, is a language with decent semantics... mixed in with heaps of cruft, reused keywords, backwards compatibility, and sharp pointy corners where you can hurt yourself. A language that starts over, with the same or similar semantics, and cleans up everything else, seems like a great idea. Hopefully they resist the temptation to throw in too much unproven but cool-sounding experimental stuff. (Maybe it's just me, but a couple of years ago, it seemed every new language had to throw in STM willy-nilly...)
- zellyn 13y agoOne more point: despite the fact that Rust and Go seem to occupy a similar region of the hacker news zeitgeist, I think C++ is the right language to compare Rust to. Rob Pike explained it better than I can: http://commandcenter.blogspot.it/2012/06/less-is-exponentially-more.html http://commandcenter.blogspot.it/2012/06/less-is-exponential...
- steveklabnik 13y agoYup, it's the position of the Rust team that Go and Rust aren't competing, they're very different and both have strengths and weaknesses: https://github.com/mozilla/rust/wiki/Doc-language-FAQ#have-you-seen-this-google-language-go-how-does-rust-compare https://github.com/mozilla/rust/wiki/Doc-language-FAQ#have-y...
- yoklov 13y agoBecause C++ is crappy, but doesn't really have any serious competitors within it's domain.
- parley 13y agoYou will probably get different answers from different people. For me it's interesting partly because I hope to get a language where managed memory is non-idiomatic and largely unnecessary while manual memory management is quite safe, i.e. no GC needed. This combined with what I've seen so far with regards to other language design choices makes me hope for something that can also approach C/C++ speeds together with broad portability - uc's (where a GC obviously is a no-no) to big iron nixes to OSX/Win to Android/iOS. Also, skipping things like GC I hope to be able to write drop-in replacements for C-libraries in Rust, with the application using the library being none the wiser. These are just a few reasons. If I am wrong to harbour any of these hopes, please correct me. Basically, I hope for good performance, portability and productivity. If I stalked the Rust github page any more often, they'd probably block my IP for DOSing... EDIT: Forgot to mention that I also hope for a large and supportive community - something I think we can already see the beginning of. People in #rust are very friendly and interesting 3rd party libraries are being produced as we speak despite the language and stdlib still being in a bit of flux. Community is so important. Also, Mozilla backing it is a big plus for me.
- bascule 13y agoIt's like Go with more features: Go and Rust offer GC. Rust allows you to choose when you use it. Rust also makes it explicit when you're allocating memory whatsoever. Go and Rust offer M:N threading. Rust provides separate heaps per "task" and a data ownership system which means you never end up sharing state between "tasks" (ala Erlang). Go only provides a global shared heap. This means Rust can prevent a class of bugs (concurrent mutation of shared state) which Go can't. It also means Rust's GC is easier to run in parallel, since state is isolated to particular tasks so you can GC a task while it's idle ignorant of the rest of what's going on in the system. Go and Rust both offer structural typing (like duck typing with static typechecking). Rust also implements Hindley-Milner, which is the same type inference algorithm used in Haskell. So Rust provides Go-like typing when you want it, and a "real" type system when you need it. Rust is immutable by default. I think the benefits of immutable state go without saying, but Rust also lets you opt into mutable state if you want it. Rust is memory-safe by default, meaning that mistakes made by programmers won't corrupt memory or cause the program to crash. However, Rust also offers an unsafe mode that provides C-like memory access, making Rust suitable for things like kernel development, bootloaders, microcontrollers, and other device firmware that still needs to do C-like things in order to function. Rust can be used for "bare metal" low-level development, to the point that you can boot directly to Rust without ever starting its runtime, and even use Rust directly on microcontrollers. See "Rust on bare metal" (lolpun): https://mail.mozilla.org/pipermail/rust-dev/2013-July/004841.html https://mail.mozilla.org/pipermail/rust-dev/2013-July/004841... Finally, Rust provides a task linking/fault-tolerance model similar to Erlang where if one task exits, tasks it's linked to are automatically notified about an exit event and can take action accordingly. Rust is a weird platypus of a language with a lot of the features you see in fancy functional languages but working in more or less the same realm as C/C++. I've heard it described as "if C++, ML, and Erlang had a kid"
- knewter 13y agoReally, really enjoyed reading this. I've not looked at rust in around a year, and that was before I got into erlang. Knowing how it deals with heap and "tasks" makes me super happy. Probably my next language?
- steveklabnik 13y ago
- jeffdavis 13y agoIt's interesting to me because it appears to offer fairly low-level control over memory, but is still memory-safe. That is unique among languages targeting the mainstream. It also seems to have a good mix of other features that I like, which others have already listed. Basically, rust has the potential be an actual C++ replacement; a real one that actually gives you control over memory.