A pair of Rust kernel modules
A pair of Rust kernel modules
Posted Sep 14, 2022 16:08 UTC (Wed) by lambda (subscriber, #40735)In reply to: A pair of Rust kernel modules by Fabien_C
Parent article: A pair of Rust kernel modules
Fair enough! I'm not an Ada expert either, so I can't necessarily speak to how the approaches compare.
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 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.
I'd love to see examples where Ada has been used successfully to rewrite parts of free software to improve safety or maintainability, let me know if you know of any!
My comments about Ada were mostly to respond to why Rust over Ada or other static analysis tools, and while I don't know Ada well enough to do a detailed comparison, there just seems to be a lot more interest in using Rust for these kinds of use cases than Ada. If anyone has writeups on why Ada would be good for this kind of use case, I'd love to see them.
Posted Sep 14, 2022 22:02 UTC (Wed)
by khim (subscriber, #9252)
[Link] (1 responses)
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. 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. 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!
Posted Jan 16, 2024 13:56 UTC (Tue)
by yawaramin (guest, #169121)
[Link]
Yes you can:
```
Sure, it's not exactly trivial; but it's possible.
> 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.
A pair of Rust kernel modules
A pair of Rust kernel modules
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;
```