Discussion:
Ada vs. Rust for low level system software
(too old to reply)
Nasser M. Abbasi
2023-12-13 04:28:40 UTC
Permalink
Has anyone made study of difference between Rust and Ada for low level hardware
system software?

Since Ada is mainly used in this area, why has Rust, which is much
younger language, and target this same area has gained so much
popularity but not Ada?

https://dl.acm.org/doi/fullHtml/10.1145/3551349.3559494

"Rust is a rising programming language designed to build system
software [4, 10, 20]. On the one hand, Rust offers access to and control
of the low-level system resources. On the other hand,
unlike conventional systems programming languages, Rust
ensures memory and concurrency safety"

"Rust often inserts bound checks at the execution time to rule
out out-of-bound accesses"

Well, does not Ada also "ensures memory and concurrency safety"
and checks for out-of-bound accesses?

I am just wondering what does Rust brings to the table that
Ada does not have and why is Rust becoming so popular when
Ada is not.

I never used Rust myself, but used Ada.

Any one done study comparing the two languages or knows
both that can give some comments on this?

--Nasser
Dmitry A. Kazakov
2023-12-13 08:27:34 UTC
Permalink
Post by Nasser M. Abbasi
Has anyone made study of difference between Rust and Ada for low level hardware
system software?
What for? Any language comparisons lost their meaning long ago as the
whole language business degraded into hobbyist/corporate bullshit.
Post by Nasser M. Abbasi
Since Ada is mainly used in this area, why has Rust, which is much
younger language, and target this same area has gained so much
popularity but not Ada?
Because it is always someone's arbitrary decision.
Post by Nasser M. Abbasi
https://dl.acm.org/doi/fullHtml/10.1145/3551349.3559494
"Rust is a rising programming language designed to build system
software [4, 10, 20]. On the one hand, Rust offers access to and control
of the low-level system resources. On the other hand,
unlike conventional systems programming languages, Rust
ensures memory and concurrency safety"
"Rust often inserts bound checks at the execution time to rule
out out-of-bound accesses"
Well, does not Ada also "ensures memory and concurrency safety"
and checks for out-of-bound accesses?
I am just wondering what does Rust brings to the table that
Ada does not have and why is Rust becoming so popular when
Ada is not.
In my view Rust brings nothing and moreover is a huge step back
comparing to Ada. Its main and only idea is to force the programmer to
explicitly manage memory through references where Ada simply uses object
notation regardless the mechanism doing same under the hood.

Safety comes not through references but by limiting the number of cases
you must resort to using dynamic allocation for statically scoped
objects. E.g. Unbounded_String in Ada.

As for my major concern - the type system and the abstraction mechanisms
in general, there is nothing in Rust at all.

Then of course Rust continues the worst practices tried by Ada and C++:
templates/generics, macros.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Luke A. Guest
2023-12-13 09:10:20 UTC
Permalink
Post by Dmitry A. Kazakov
What for? Any language comparisons lost their meaning long ago as the
whole language business degraded into hobbyist/corporate bullshit.
True.
Post by Dmitry A. Kazakov
Post by Nasser M. Abbasi
Since Ada is mainly used in this area, why has Rust, which is much
younger language, and target this same area has gained so much
popularity but not Ada?
I would say because they aimed to be a C++ replacement.
Post by Dmitry A. Kazakov
Because it is always someone's arbitrary decision.
True.
Post by Dmitry A. Kazakov
templates/generics, macros.
What's the alternative to generics?
Dmitry A. Kazakov
2023-12-13 09:53:28 UTC
Permalink
Post by Luke A. Guest
Post by Dmitry A. Kazakov
Then of course Rust continues the worst practices tried by Ada and
C++: templates/generics, macros.
What's the alternative to generics?
The question is what is the alternative to static/parametric
polymorphism. The answer is dynamic polymorphism.

1. Dynamic polymorphism in Ada is as static as generics are. No run-time
penalty unlikely to C++.

2. It covers cases generics do not, e.g. you can have class-wide
run-time objects and proper class-wide subprograms.

3. It supports modular programming en large. E.g. you can put a class
member in a dynamically linked library.

4. It is fully testable. Generics are fundamentally non-testable, only
concrete instances are.

5. It is does not create a meta language layer with complexities for the
compiler and programmer. Advanced generic code is close to unmaintainable.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
Jeffrey R.Carter
2023-12-13 08:44:34 UTC
Permalink
Post by Nasser M. Abbasi
Has anyone made study of difference between Rust and Ada for low level hardware
system software?
You might be interested in this discussion:

https://www.reddit.com/r/ada/comments/18c2nr4/where_is_ada_safer_than_rust/
--
Jeff Carter
"I used to manufacture escalator shoes for people
who were nauseous in elevator shoes."
Take the Money and Run
142
Kevin Chadwick
2023-12-18 12:52:08 UTC
Permalink
Post by Nasser M. Abbasi
Since Ada is mainly used in this area, why has Rust, which is much
younger language, and target this same area has gained so much
popularity but not Ada?
Adas ranged type system coupled with it's excellent record overlays make Ada
a much better choice than Rust. For safe and easy hardware register and
network protocols.

I can't imagine that ownership for data structures on a single runtime is
the reason (before SPARK got support).

A lot of Ada code will not run on any runtime but Rust also has nostd for
embedded use.

They often say Rust has excellent C interfacing support but Adas appears to
be even better.

Perhaps it is ease of use and guide availability which has improved or
simply perception and a lack of knowledge about Ada.

Rather than language merits. A lot of people only care about job
availabilty, money and library availability today but might consider a risk
if they perceive a future demand increase.

As to why the likes of Google and Microsoft are putting money behind it when
Ada would have been a better investment. You would have to ask them. Tell
me why Google continues to write security sensitive code like matter in
C++? When it could be written in Ada or Rust with a C binding.

Even javascript engines like Mozillas spidermonkey still has so little Rust
code. Though Mozilla does have more financial concerns and it's competitors
are already trying to say their browsers are faster. Yet Googles websites
use umpteen domains slowing browsing down anyway.
--
Regards, Kc
Loading...