
A Random Walk Through Ada (2014) - akalin
http://cowlark.com/2014-04-27-ada/index.html
======
Keyframe
Every time I see something on Ada, it seems like a really nice language. Easy
to read, easy to write, performance seems to be there with C++, easy (?) to
interface with C, multi-threading seems to be somewhat easy too...

So, what's the deal, where's the catch? Why people aren't jumping on it like
they do with, I don't know, Rust?

~~~
douche
It doesn't have that novelty factor. One could ask similar questions about D,
which has for a long time positioned itself as a friendlier C++, but hasn't
had any of the buzz that Rust or Go or Nim, etc have garnered.

~~~
Keyframe
A bit tangential, but I did (heavily so) jumped into D before D2 and kind of
got burned with that. I married D1 which was more in-line with "a better C"
and then everyone decided D2 was the way to go, which was more "a better C++".
It was to be expected though since language was in flux a lot at the time.

Ada is a stable language though. I get what goatlover and Avshalom here are
talking about here. That it's not fashionable (anymore). If we remove
ourselves from that, are there any specific technical reasons why Ada hasn't
been picked up by, let's say, C++ programmers? That is, audience that needs
performance, yet also a nicer and safer language.

With Lisp(s) there was a long period of basically having to pay for a good
implementation and runtime deployments to Franz for Allegro if you wanted to
do something well on desktop. I recall only Nichimen with Mirai and Nendo
doing it, and it was fabulous. Makes you think about what would happen if
tooling was free at the time, or at least more affordable.

From everything I've seen, so far, Ada seems to be technically ready language
to do game development, where probably most of language-curious crowd lives
these days. I'm not sure about mobile support though (gcc on Android or
whatever it is on iOS).

Every now and then I take a week of spare/hobby time and endeavour into new
and weird technical spaces. Maybe, my next one will be in Ada space.

~~~
lispm
Lisp on Windows has a long tradition, but all useful implementations with
platform integration and good GUI support for it were and still are
commercial.

Corman CL. Cheap. Native. Abandoned and now open source / free.

Golden Common Lisp. mid-price, lots of functionality. No longer competitive.

Procyon CL. Expensive. Bought by Franz and taken from the market and used to
develop a first Allegro CL for Windows offering.

LispWorks. Expensive.

Allegro CL: Expensive. Lots of functionality. Nowadays a merge of the former
Windows and Unix versions.

There are free ones like Clozure CL, GCL, SBCL. But most of them lack platform
integration.

Btw., Nendo was written in C++.

~~~
Keyframe
I didn't know Nendo was C++. Somehow I thought since Mirai was Allegro that
Nendo was also. TIL! Mirai was so ahead of its time, and I remember people
were boasting Lisp had a lot to do with it (small team, big features and lots
of them!). Of course, team was amazing - that was the primary reason.

SBCL kind of got better over the years though.

~~~
lispm
Nendo was originally developed in C++ for the Nintendo 64 system. It wasn't
released there, but as a Wintel application.

> Mirai was so ahead of its time.

Mirai is actually based on earlier code: N-World from Nichimen, which was a
port of S-Graphics of Symbolics, which was written in the early 1980s.

[http://lispm.de/symbolics-3/symbolics-3.html](http://lispm.de/symbolics-3/symbolics-3.html)

> SBCL kind of got better over the years though.

If you look at CL Windows applications, they are either written in a custom
Common Lisp implementation or Allegro CL / LispWorks.

Free software / open source Lisp has never supported Windows very well. Most
of the time the Lisp was running without much integration and very little
support for the Microsoft eco-system. Companies tried to target the market of
Windows users. Open source / free software Lisp developers were never
particular interested in Windows for their own use

------
axman6
(Reposting from lobste.rs)

It's a shame there wasn't more information on the tools Ada provides for
concurrency - I haven't seen another language which gives you as much
flexibility and power to write safe concurrent code. It's much more heavy
weight than some other languages in some ways, but gives you very strong
guarantees you don't get elsewhere.

It also would've been nice to talk a bit about some of the features which make
it particularly well suited for embedded systems:

* things like the ravenscare profile which give you a safe subset of the language using statically allocated never terminating threads

* the ability to select the scheduling algorithm (including ones with task priorities which are used to avoid the possibility of deadlocks completely - see the priority ceiling protocol for more details)

* the ability to address specific memory locations being built into the language, not just casting ints to pointers like you would in C

* full control over how elements on records are laid out, including endianness, this is essential with the previous feature when you're dealing with memory mapped IO registers for controlling hardware

* the ability to define that certain data types can only be used at certain specific memory locations (see [https://cs.anu.edu.au/courses/comp4330/Lectures/RTES-03%20In...](https://cs.anu.edu.au/courses/comp4330/Lectures/RTES-03%20Interfaces.01.pdf) "pages" 314 - 332)

For anyone who's had to write code to interface with hardware on micro
controllers, they're probably wetting themselves with excitement by now, doing
this in C relies on the compiler doing what you think it will, which there's
no guarantee of because the ability to use many of the features is
implementation defined, if defined at all.

ANU's COMP4330, which these slides come from, is an excellent resource for
learning more about both Ada and real time systems in general:
[https://cs.anu.edu.au/courses/comp4330/1-Lectures-
Contents.h...](https://cs.anu.edu.au/courses/comp4330/1-Lectures-
Contents.html)

~~~
_pmf_
A really nice book on the topic is "Concurrent and Real-Time Programming in
Ada".

~~~
pjmlp
Another one is "High Integrity Software: The SPARK Approach to Safety and
Security".

------
Tomte
Another cool thing in Ada world: SPARK.

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

------
ar-nelson
This really makes me want to try Ada, if I could find a good fit for its low-
level features (game development, maybe?)

The biggest thing that would make it annoying to write in is the verbose
syntax--it's like the worst of Java, VB, and Standard ML. And yet, that same
verbosity makes it kind of nice to read.

I think there's an inherent friction between "write-friendly" and "read-
friendly" languages. It would be nice to have a language with a few different
"dialects" (the way Ruby often has several equivalent ways to write certain
constructs), such that a programmer could write the initial code in an
extremely terse language, then run a formatter and get back a beautifully-
formatted, much more verbose form of the same code.

~~~
Keyframe
Verbosity leaves me on the edge as well. But then I look at the promise of
what Ada brings. It would mean trading in a bit more writing time for a
possibility of a lot less debugging time.

~~~
fghgfdfg
Anecdotally, it's vastly reduced debugging time in my own personal projects.
My most notable problems have all turned out to be the result of things like
using the wrong input, or misunderstanding some external spec. At first it was
actually a little unnerving that things weren't breaking, but with time I've
come to expect that. I came from C++, where I always joked that if things
appeared to work correctly the first time around something serious was broken.

It's not free though. You do end up spending more time getting the compiler to
actually accept your code. With time I've gotten much better at this, although
at first it could be quite a fight. But a compiler error is so much nicer than
a bug, so I do think it's very worth it.

And when it comes to coding, how long it takes to type is pretty irrelevant as
long as you can type half decently. Typing the code is really the easiest
part.

------
tomrod
I haven't learned Ada yet, but I've heard praise and eulogies from HN a few
times it has been mentioned in recent years.

At first pass, it appears to have a lot of unnecessary keywords, and the
semicolon terminator (at first pass) seems arbitrarily required.

Is it really that great of a language? What does it provide that FORTRAN, C,
and/or Julia don't provide in terms of speed, or Python in terms of
readability?

~~~
toomanybeersies
The advantage of Ada is that it's meant to be an incredibly safe language.

That's why blocks have to end with the block type (e.g. if...end if)

This is to ensure that you haven't accidentally nested things wrong. It also
has runtime bounds checking for arrays, ranged variables, no multi-line
comments, safer pointer handling etc.

At the time, it was definitely one of the safest languages to use.

Fortran is a real pain to read or write, and is designed more scientific
computing than applications. C is terribly unsafe (hence why buffer overflows
are the most common security vulnerability).

------
cturner
Quick note others may find useful. I found this offputting: the idiomatic
mixture of upper/lower case and underscores in the syntax. Unnecessary
cognitive overload. I've just done a quick test with current gnat and this
works: you can just write everything in lower-case.

------
zem
this is a really good feature that i've never seen elsewhere:

> For extra robustness you can name blocks and use the name when closing them.
> In the above example, I could end the procedure with end Program.

------
didip
So, the question I have is:

What is the OSS compiler for Ada that works on Linux and OS X?

~~~
Keyframe
I'm just going through the motions. GCC has FSF GNAT which I wan't on macOS,
but in order to compile gcc with ada support you need to have GNAT already.

So, what I'm doing now is: download GPL GNAT from Ada Core here:
[http://libre.adacore.com/download/](http://libre.adacore.com/download/) and
build your gcc, as usual, with ada support from that. Then you can use FSF
GNAT gcc. You can even compile again with FSF gcc to make it double sure it's
working.

Apparently, FSF GNAT version is what you want in order to make commercial
software since it has a runtime license, which Ada Core version doesn't. You
would have to pay for Pro version. Someone correct me if I'm wrong.

------
Narishma
Needs a 2014 in the title.

~~~
Avshalom
Ada 2012 is still the most recent standard.

~~~
throwaway7645
The language is pretty old. I'm not sure it needs a huge amount of extra
features. They added full OO support awhile back, although its probably not
necessary for a lot of embedded projects. There's a company (Ada Core I think)
that keeps their products up to date.

~~~
username223
Indeed, that company is Ada Core, and their pricing page tells you everything
you need to know about why you're not using Ada:

""" All of our products are available as annual subscriptions... For general
inquiries regarding our products and solutions or to learn how you can apply
for an evaluation, please contact sales@adacore.com.

Use the following form to receive a price quote. Please fill it out as
completely as possible so we can provide you with the most accurate pricing
information. """ \--
[http://www.adacore.com/gnatpro/pricing](http://www.adacore.com/gnatpro/pricing)

In other words, standard Enterprise Pricing: "if you have to ask, you can't
afford it."

~~~
Avshalom
Of course on the other hand

    
    
      sudo apt-get install gnat

