4 ms·
Rust: it provides extremely strong guarantees about your code at compile time so that usually it feels like a script language with C/C++-levels of performance.
by jjpe 10y ago
Rust: it provides extremely strong guarantees about your code at compile time so that usually it feels like a script language with C/C++-levels of performance. And the best part: no data races, and no runtime garbage collector overhead.
- ryanlm 10y agoIs that all? That's a pretty generic reason IMO.
- scott_s 10y agoI think you are underestimating how hard it is to get those guarantees, how much some people want them, and how long we've needed them.
- stusmall 10y agoTo long time C developers, it's a huge deal. I'm starting my first primarily rust job on Monday and I'm extremely excited about it.
- dikaiosune 10y agoWhere, if you don't mind sharing?
- rvense 10y agoDepending on much experience you have with ML-y type systems, Rust will either feel a little boring or like a revelation. The combination of pattern matching and algebraic data types is incredibly powerful and expressive and unlocks a style of coding where what in other languages would be potentially buggy logic that needs to be tested becomes mechanically checked typing information. Often, code can be trusted to just work if the type checker accepts it, which is especially handy if you make major changes to a large programme. Rust also favours immutable data structures, which also means some classes of bugs stop showing up in most cases. I've found these things to be a major productivity enhancement, maybe on par with going from manual memory management to garbage collection. Which is another reason to be excited about Rust - it is to the best of my knowledge the only new language that allows you to write an entire programme or part of a programme that does no runtime memory allocation. While GC in most languages is not problematic in most cases, this makes it suited for embedded or hard-realtime work where C/C++ may have been the only option up until now. But it still has all these expressive, high-level features and safety mechanisms that makes it so suitable for programming well-structured, trustable software. There's a learning curve moving from GC to the ownership system, and maybe a plug-in garbage collector makes sense in some cases, but then the system does support that. And then there's the tooling. Setting up a cross-compiler (again, embedded work), bringing in libraries from online repositories, packing up code modules for distribution and reuse, all that, is as easy as you'd expect coming from the web world because of the excellent Cargo system. In short, while it might not be completely battle-tested yet, I think it has a better shot at being the "one language" that scales from tiny throw-away projects to large, complicated ones, and from watches to super computers than anything else I've seen.
- jjpe 10y agoAs rvense explains below, there are a number of very desirable consequences to rusts strong static guarantees, and even performance improvements, all while getting less buggy code. It's even more secure in the sense of being less exploitable: the bugs being prevented by the type checkers are largely about resource allocation e.g. memory but also file handles. And those are often easily exploitable when not properly managed. That kind of compile-time bug prevention is something runtime garbage collection (that is, every VM platform out there) has yet to achieve and so is pretty amazing if you ask me. Another consequence is the sheer range of applications for which this language can be practically used: systems and concurrent programming obviously, but also Web, realtime, embedded and even supercomputer programming. The reason for that is that rust mostly feels like a light weight scripting language like python, but because of its performance characteristics can viably be used as a drop-in replacement for C.