by rsj_hn · 5y ago · 0 comments
In that sense, Rust is a good evolution of C down this path, but it remains a systems language, which is an ever-shrinking percentage of the software ecosystem, even if Rust itself is growing as more C programmers try to switch over to a language with more high level features.
Rust has a niche, and it is a big one, where a lot of C++ used to be. If you cannot afford GC pauses (all sorts of servers) and need fine control, rust could very well be for you. It will win in that space.
System programming is not a "ever-shrinking percentage of the software ecosystem". It is a constant percentage. As we develop systems we need languages like Rust.
Historically this doesn't seem entirely true. We haven't gotten much higher level than Java, outside of non-eng niches where we haven't gotten much higher level than Python (which is arguably lower level than R, which has been unseated).
So I don't think it holds true that we'll continue to chase a higher abstraction layer. We recognize the cost of doing so, and it hasn't been worth paying so far.
Besides that, Rust is quite capable of providing high level abstractions. I myself am building a sandboxing mechanism in Rust that will be entirely managed for you but with no runtime cost (it's generated statically) - it is Rust's low level power that lets me build such high level abstractions.
I heard that pre-Unix mainframe operating systems had a baked-in database rather than a filesystem, Lisp/Smalltalk had persistent images, etc. So I don't know if these abstractions are new, or just going mainstream. Capability-based security systems have been written about in academia for decades (according to https://en.wikipedia.org/wiki/Capability-based_security#Refe...).
What's the point of a memory safe language if your whole program could fail for a simple out of memory condition? With C I can allocate all the memory that I need upfront, as a static variable either global (yes, they are not the devil) or inside a single function. That way the compiler can tell me if my program will fit in memory or not.
And yes, I know that in Rust you can avoid using the standard library and you can manage the memory yourself in unsafe blocks. But... what's the point on fighting the language when you can just use C?
All the things that are said about C, it's unsafe, nowadays you have tooling, every decent compiler will warn you if you try to do stupid things.
The point is to be able to do more complex things more easily and performantly, while also not introducing trivial security vulnerabilities like buffer overflows.
> But... what's the point on fighting the language when you can just use C?
The point is to learn not to fight it. At that point, the language becomes much more effective to use than C.
Proper C, which is not full of holes and undefined behaviour, also feels like fighting in the beginning. Empirically, it is also a fight that is won much more rarely.
And yet Microsoft, Mozilla, Google, etc. all peg 70% of the bugs in their C codebases as memory and pointer problems.
Apparently the tooling isn't good enough to stop this.
Actually no. The most important qualities for a language to quickly gain popularity are:
* Low barrier to entry
* Who is backing it (Go, Java, C#)
* What platforms it opens up (Swift,ObjC,Kotlin/Java) that require that language.
Rust barely has 2 and 3. Mozilla never pushed it much and it also is not a huge employer. It has 3 if you strech the definition.
Python was popular way before machine learning went mainstream.
> 1 is the most important.
1. is super important, but keep in mind that Python having a much higher barrier to entry than PHP on the web didn't stop it from becoming popular in that field.
Also 1. is really context dependent, and even if Rust has a bigger barrier to entry than Python, it has a much smaller one that its direct competitors (C and C++) because of its documentation, learning material, compiler error messages and dependency management.
Regarding 2. you must have missed the news: Rust is now officially pushed by Microsoft, AWS, Google and Facebook. In fact you'd have difficulties to find languages with stronger corporate backing than Rust today apart from C# and Java.
This may not be obvious at first, but AFAIK the majority of Rust users come from web languages (mostly JavaScript, Ruby and Python) and the fraction of programmers doing native/low-level stuff had been declining for decades and Rust is bringing a lot of new people to it.
(Also webassembly, but it's a much smaller niche at the moment)
C++ was the evolution of C and so was Java, but they both turned out to be their own things and C kept on chugging. Rust is a big complicated language, there is nothing C like about it. I see more parallels between Rust and C++ than I do Rust and C.
This exists in 4GLs (https://en.m.wikipedia.org/wiki/Fourth-generation_programmin...)
In special because the way rust do things now is THE optimal way to work:
Rust is GROWING.
In this step (let's call it the adolescent) is NOT THE TIME to stop for the needs of C, C++, Debian, or anything else that is glacially slow to change, generate BILLONS of losses in this industry, and is arcane as hell...
In fact, I wish it not be that conservative moving forward.
But where is genius all of this? Is that despite the forward momentum it NOT fell "broken by design" at all. Is one of the few tools in my +20 years on the trade that I can update with confidence and that actually NOT DEMAND to change all my code as often as it look like.
So this is the real experience with Rust: All stuff is very carefully considered as much as possible, not major big mistakes, cargo si GOOD!, and because that, update is painless, and still: You don't need to refactor code in each update, you get benefits without major costs (more performance! better internals!), and still can profit for the work of everyone in the community.
P.D: Rust is certainly made with CI-oriented deployment as the preferred way to work. If wanna move forward glacially, I don't see how is that impossible. In fact I bet you can stop updating, wait 2-3 years, do a big refactoring and move along. This is how ACTUALLY was in the past with tools like C# and others, and I pretty sure Rust will make that thing much easier to shallow...