|
|
Subscribe / Log in / New account

A pair of Rust kernel modules

A pair of Rust kernel modules

Posted Sep 14, 2022 22:02 UTC (Wed) by khim (subscriber, #9252)
In reply to: A pair of Rust kernel modules by lambda
Parent article: A pair of Rust kernel modules

> I can say that I've seen a lot more work in the free software world to incrementally port portions of software to Rust, such as the original motivating example of Firefox, librsvg, curl, and this work in the Linux kernel, than I have in Ada.

The biggest problem of Ada IMO is that it was always supposed to be about safety, but it never addressed the most common source of bugs: pointer safety. Not even with SPARK. It's like discussing about how can you fortify the door in a house with three walls. I suspect they planned to solve it like everyone else (with tracing GC), but that never materialised (because most Ads users don't want tracing GC) thus was always kinda weird “safe” language which doesn't tackle the most common source of bugs.

Finally, in year 2020, it solved that problem. By picking ideas from Rust, of course.

But by that time momentum was lost and it would be very hard to overcome that “safe language without safety” stigma.

In addition Ada very much likes to live in the world where it can dictate the rules thus Rust is much more suitable for the kernel IMO.

> The mindshare in Ada seems to mostly be around safety-critical systems, while Rust seems to appeal to free software developers more as a general purpose programming language, which provides some better guarantees out of the box than C or C++ do, even when not doing a full formal verification process for safety critical systems.

It would be interesting to see how well Rust would do there. I'm not sure Rust would be able to push Ada from that niche, but it's also highly unlikely that Ada would be able to go into general-purpose computing.

Mindsets of Ada programmers and general-purpose computing programmers are just too different.

> If anyone has writeups on why Ada would be good for this kind of use case, I'd love to see them.

It wouldn't. Ada provides some additional facilities which Rust doesn't provide (such as range types), but these are not dependent types which are needed to express safety and thus add bloat to the language without improving safety much.

This about it: the most famous example of range types are months and days… and yet, in Ada, you can not define type for day-of-month which is between 1 and 28 for February and 1 and 31 for January!


to post comments

A pair of Rust kernel modules

Posted Jan 16, 2024 13:56 UTC (Tue) by yawaramin (guest, #169121) [Link]

> and yet, in Ada, you can not define type for day-of-month which is between 1 and 28 for February and 1 and 31 for January!

Yes you can:

```
procedure Adaproj is
type Month is (Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec);
type Month_Day (M : Month) is record
case M is
when Sep | Apr | Jun | Nov =>
Day1_30 : Integer range 1 .. 30;
when Feb =>
Day1_29 : Integer range 1 .. 29;
when Jan | Mar | May | Jul | Aug | Oct | Dec =>
Day1_31 : Integer range 1 .. 31;
end case;
end record;
begin
null;
end Adaproj;
```

Sure, it's not exactly trivial; but it's possible.


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds