Hi people, I’m new to rust and am curious about how high level is rust compared to another languages. I have a list of what languages to compare and I wanna know where you would classify rust among them.
The languages are: C, C++, Objective-C, D, Go, Swift, Pascal, Fortran, BASIC, Cobol, C#, Forth and Java.
When I talk about low and high level language I’m referring to how much control the language gives to the hardware and what has more abstraction levels.
Well, rust can technically go as low as assembly, but the beauty of it is the fact it can provide high level abstractions like the ones found in C# (Unfortunately I only have previous experience in C# before coming to Rust), and some from Swift, while still providing the same speed and low-latency of C++. It can also run code similar in control to C or C++ with the unsafe keyword. Its biggest selling point in my opinion is the reference checker – something that can give the same power as a GC as in languages with a GC without the overhead or complications of a GC.
Rust is weird in that regard — it’s both high level and low level.
But it doesn’t hide low-level parts, so you get stack vs heap distinction, machine-sized integers with manual conversion, and ugly bits sticking out like #[no_mangle].
IMO it’s the best of both worlds (high level / scripting languages vs low level / system languages), but with a knowledge cost attached that’s typical for system languages e.g. you need to know about the call stack and the heap, something you generally don’t need to care about when using e.g. Python or Java.
For those who are able and willing to pay that cost, I’ve yet to see a project where rust would be a catastrophic choice.
Drop everything with a garbage collector from that list. One can emulate a GC language from within a non-GC language, but it's impossible to emulate a non-GC language from within a GC language. Which means that GC != non-GC languages.
My comment was mostly to inform @bmelo that they can find plenty of existing discussion around “how high/low level is Rust”, in case they wanted to start reading before anyone replied here. I wasn’t trying to dissuade any discussion from happening here. And FWIW, I will note that I’ve not seen anything “new” mentioned here thus far from any of the numerous previous discussions around this topic, on this forum or elsewhere .
The simplest characterization I have for Rust is that it’s a natural evolution of C++, with a clear understanding of its benefits and very good solutions for many of its problems. I also find that it adds a small but well-chosen set of useful language features (such as destructuring bind and the ? operator). I am not even sure about who I should congratulate for this design and I sure hope that it doesn’t devolve.
I am not aware of anything as good in the GC languages but if anybody has suggestions I’d like to hear them. I started using Go recently and even though it’s a nice improvement from Python, it makes me miss Rust.
Comparison with Fortran is trickier. My understanding is that C never took off in scientific computing mainly because it lacks a good multidimensional array type with user-defined bounds. You can define such a type in C++ but I am not sure that typical compilers could do the proper loop optimizations, at least early on, or that typical programmers trusted that the compilers could do them. Also scientific programmers don’t take the C++ learning curve well. (And will not take the Rust curve well either.)