[Info-vax] Rust as a HS language, was: Re: Quiet?
Arne Vajhøj
arne at vajhoej.dk
Tue Apr 5 19:46:34 EDT 2022
On 4/5/2022 9:04 AM, Bill Gunshannon wrote:
> So, I have been following this discussion for some time now. I have
> never used Rust. I have never even looked at Rust. But I do have one
> question.
>
> Just what is it that Rust can do that none of the already existing
> languages could do?
(this is going to be a bit high level as I don't code in Rust)
There is probably nothing that Rust can do that other languages
can't do. Most stuff can be done in any language.
But there may be some things where Rust is better than other
languages.
It is a modern language in the low level category.
Modern means that it has looked at problems with older
languages and tried to fix those.
Low level makes it rare, because there are not many modern
languages that are low level aka intended to be close to
the metal and able to be used for OS and similar code.
Go to high level code for business application and there
are a ton of languages:
* JVM languages - Java, Kotlin, Scala, Groovy
* .NET languages - C#, VB.NET
* JavaScript, TypeScript, Dart
* PHP, Hack
* modern C++
* Python
* Ruby
and that is just the most widely used one - there are dozens more.
For low level I can only think of two: Rust and Go. And they seem to
have found different markets - the OS people like Rust and the
container people like Go.
C and C++ are currently dominating the low level code area, but
there are some well known problem.
Two of those problems are:
* buffer overruns
* memory leaks
Of course it is possible to write C and C++ code without risk
of buffer overruns and memory leaks.
But decades of experience shows that at scale like hiring 100
average developers to write 1 million lines of code, then a
number of those problems get introduced.
Rust avoid those.
Rust checks memory access *unless* in an unsafe block (idea borrowed
from C# language). As a low level language Rust has the need to be able
to do some flexible memory access - I can not imagine it is
possible to write a device driver if only able to access memory
in variables in the program.
Rust has a unique approach to memory handling based on
ownership (idea borrowed from modern C++ best practice
not C++ language) that avoids memory leaks without GC - as
a low level language that may be used in real time
context, then the standard solution to avoid memory
leaks in high level languages GC could be problematic.
Arne
More information about the Info-vax
mailing list