News for hackers. Stuff that matters.
Re:Ada's Dependent Types, and Its Types as a Whole by LiamPowell on Saturday December 28, 2024 @01:57AM (#42529160)
I'm a bit disappointed that we've ended up with Rust in the kernel but not Ada. The kernel relies on GCC and there's already an Ada compiler in GCC, so it wouldn't require adding another compiler as a build requirement like Rust does.

There's a couple of major advantages that Ada could have in the Linux over Rust for safe drivers:

1. Having the option to use SPARK for fully verified code provides a superset of the correctness guarantees provided by Rust. As mentioned in the parent comment, Rust focuses purely on memory safety whereas SPARK can provide partial or complete verification of functional correctness. Even without writing any contracts, just preventing things like arithmetic overflows is incredibly useful.

2. Representation clauses almost entirely eliminate the need for the error-prone manual (de-)serialisation that's littered all over Linux driver code: https://www.adaic.org/resources/add_content/standards/22rm/h...

Re:Ada's Dependent Types, and Its Types as a Whole by quietbritishjim on Saturday December 28, 2024 @03:30AM (#42529492)
> 2. Representation clauses almost entirely eliminate the need for the error-prone manual (de-)serialisation that's littered all over Linux driver code:

Do representation clauses let you specify endianess? From a quick glance at that link it didn't appear so. I would imagine that invalidates most use cases for them.

Re:Ada's Dependent Types, and Its Types as a Whole by LiamPowell on Saturday December 28, 2024 @03:42AM (#42529543)
You can specify endianness, but only over the entire record, not an individual field. The way it works is a little complicated: https://www.adacore.com/gems/gem-140-bridging-the-endianness...
Re:Ada's Dependent Types, and Its Types as a Whole by quietbritishjim on Saturday December 28, 2024 @06:54AM (#42530384)
Interesting, thank you. I think per-record is probably good enough for most applications, and less verbose than per-member. But it's not part of the language (that page calls it "implementation specific") and quite recent (that page is undated but references Ada 2012 so must be since then). It wouldn't have helped the Ada project I'm working on, which had an endianess crisis with serialisation a few decades ago.
Re:Ada's Dependent Types, and Its Types as a Whole by Jtsummers on Saturday December 28, 2024 @10:31AM (#42531723)
Re:Ada's Dependent Types, and Its Types as a Whole by LtWorf on Saturday December 28, 2024 @03:00AM (#42529393)
rust is in the kernel to attract the young developers, which ada does not.
Re:Ada's Dependent Types, and Its Types as a Whole by Lucretia9 on Sunday December 29, 2024 @09:57AM (#42540320)
GetIntoGamedev is not old, he's in his 20's. The issue is, is that people are not prepared to trying something if it doesn't look like C or C++.
Re:Ada's Dependent Types, and Its Types as a Whole by LtWorf on Monday December 30, 2024 @04:34AM (#42547910)
But he's one. See how many people are jumping on the rust bandwagon…
Re:Ada's Dependent Types, and Its Types as a Whole by Ygg2 on Saturday December 28, 2024 @03:17AM (#42529448)
> I'm a bit disappointed that we've ended up with Rust in the kernel but not Ada.

Why? Do you program in Ada or Coq?

People can't be bothered to track lifetimes, what makes you think they are ready to track pre/post-conditions, invariants and do it efficiently and thoroughly.

Re:Ada's Dependent Types, and Its Types as a Whole by LiamPowell on Saturday December 28, 2024 @04:43AM (#42529797)
Having the option there is good, even if not everyone uses it. The same thing applies to Rust.
Re:Ada's Dependent Types, and Its Types as a Whole by Ygg2 on Saturday December 28, 2024 @07:22AM (#42530546)
For Rust and Ada in Kernel they need to be accepted by kernel maintainers.

And seeing they can't stand Rust, when its constraints are much weaker than say Ada.Spark what chances does it have?

To paraphrase some computer science guru: The cyclical nature of programming languages is all to blame on collective programmers. Rather than being guided by mathematic rigour, they are guided by a fashion sense.

Re:Ada's Dependent Types, and Its Types as a Whole by kevlar700 on Saturday December 28, 2024 @06:54PM (#42536019)
Agreed. It would also alleviate the maintenance issue as Ada was designed to reduce software costs. Realistically the obly way this will have any chance is if a few developers were funded full time to work on it. There seemed to be a few full time devs pushing Rust support and some drivers before it was taken seriously. Honestly Ada is the best language that I have seen for drivers and for network stacks or for registers received as bytes. Linux is missing out.
Re:Ada's Dependent Types, and Its Types as a Whole by ksec on Sunday December 29, 2024 @09:30AM (#42540183)
>ended up with Rust in the kernel but not Ada

Linus hated Ada. I suspect he doesn't exactly like Rust either but the Tribe is just too strong within Linux.

Re:Ada's Dependent Types, and Its Types as a Whole by Jtsummers on Sunday December 29, 2024 @12:49PM (#42541501)
Do you have a source for that? I've found his remarks on Pascal and C++ but not Ada.
Re:Ada's Dependent Types, and Its Types as a Whole by ksec on Monday December 30, 2024 @12:06AM (#42546651)
Linus' opinion on Ada (vs Rust):

> We've had the system people who used Modula-2 or Ada, and I have to say Rust looks a lot better than either of those two disasters.

https://www.infoworld.com/article/2247741/linux-at-25-linus-...