-- Leo's gemini proxy

-- Connecting to gemini.ucant.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini

Re: Fast Thoughts on a Fast Language


gemini://tilde.pink/~slondr/fast-thoughts-on-a-fast-language.gmi


slondr has written up four thoughts on the Ada programming language. As the maintainer of one of the world's most widely used Ada programs, I couldn't resist weighing in. Sadly this program is used for cheating on Latin translation homework, rather than Ada's more glamorous niches of aerospace or security kernels.


Thought 1: the importance of the legal framework around programming languages


Ada benefited from being a US government project. It meant that the spec and surround materials were explicitly not under copyright or similar legal restrictions. Ada was the outcome of a US Department of Defense mission to eliminate the cottage industry in weapons-platform-specific programming languages. The language they designed was not widely adopted, but it *did* save American taxpayers from forking out to maintain a compiler for each type of missile the USAF wanted to use.


The US government origin meant that the language design was chosen competitively, and that the government tried to police extensibility. Not as Gemini does, by designing for INextensibility, but by creating a compiler test suite that tried to detect if vendors were extending Ada. Richard Stallman rather liked this *lack* of a proprietary specification and enforced absence of proprietary extensions, and contributed something to the conventional implementation strategies for compilers (the ali files).


https://en.wikipedia.org/wiki/Ada_Conformity_Assessment_Test_Suite


Ada was designed by the winner of the design competition, Jean Ichbiah, who had many virtues. However,

"Ichbiah’s former colleagues point out that Jean was a “control freak” and a
“nano-manager”. As we will see below, this had an impact on the Ada program
library concept which was fixed by Richard Stallman and Robert Dewar who are
both at the extreme opposite of “control mania” and “nano-management”."

https://www.ada-europe.org/archive/auj/auj-33-3.pdf


Of course, Stallman and Dewar, apart from their opposition to bureaucratic obstructionism, could not have been more different in temperament: Dewar was CEO of a defence contractor. Stallman is a much more counter-cultural figure.


Thought 2: the reputation of the Ada language is wrong


I'm completely unfazed by surface syntax. Ada syntax is from a minority tradition, in the family of Pascal and SQL, rather than the mainstream Algol/C/Java/Rust tradition or a minority one like Lisp, Prolog/Erlang or ML/Ocaml/F#. So Ada picked up some of the bad rep of the didacticism of Pascal, on top of the association with mandatory use for US military projects. It was seen as boring and verbose and clunky.


It just *isn't* clunky; it merely *looks* that way. Adopting a an all-lower case coding standard for your codebase can counteract this somewhat.


Ada, as slondr notes, can do low-level bit-twiddling. I find C programmers tend to find this property reassuring. In particular, Erlang can do functional programming style pattern-matching at the bit-level, without needing the bits to be byte-aligned, which really raises the C programmer's bushy eyebrows. Similarly, Ada has appropriate bit-twiddling facilities out of the box.


Ada's a kitchen-sink language and one where all the large collection of facilities have been designed carefully by a single controlling mind. It's fine on that front.


The type system is a way behind ML and Rust, but well ahead of C++. You get discriminated unions, but no exhaustive pattern matching. There is also a system of safeish pointers.


Thought 3: SPARK and unsafe


On the subject of safety: there are "profiles", a compile-time parameter to enable or restrict the use of certain facilities.


There is also a set of annotations called SPARK. SPARK lets you prove that your code has no run-time errors. This involves annotating functions with contracts. It is a completely different way of programming. You must design your program from the start to use it. I could barely implement integer multiplication. But it is nice to know that if I did need to write code with bounded storage and CPU, and no runtime errors, the tools are there to prove these properties. People have written OS kernels and avionics code in SPARK/Ada.


These sorts of facilities do not, yet, exist for languages like F* or Rust.


https://en.wikipedia.org/wiki/SPARK_(programming_language)

https://muen.codelabs.ch/


Thought 4: serialisation is there but idiosyncratic


Ada has an opinionated default way of (de-)serialising data, including sum types. I was quite struck by how quickly you get used to this with structured data in a staticly typed language with no tradition of code generation.

-- Response ended

-- Page fetched on Thu May 2 20:40:09 2024