Introduction to Ada
learn.adacore.com
learn.adacore.com
http://www.ada-auth.org/standards/rationale12.html
I did contribute the HTML version of the Ada 1995 Rationale (first language revision) back in the day:
https://www.adaic.org/resources/add_content/standards/95rat/...
(Actually the original rationale is for ANSI C89, which differs from ISO C90 mostly in the way the sections are numbered.)
C89: https://www.lysator.liu.se/c/rat/title.html
C99: http://www.open-std.org/jtc1/sc22/wg14/www/C99RationaleV5.10...
I bet most people around here aren't aware of those ones for C.
It took a while, but I was finally able to escape and start working with more modern technology (involved a lot of self-learning on side projects and finally finding a rare employer that believed engineers are capable of learning new skills).
I do occasionally get emails from recruiters looking for Ada programmers - they're exclusively for legacy maintenance. Fortunately, I'm in a position to ignore them now :)
As a language, Ada isn't bad. I'd prefer it over C++ or Golang for sure, but there just isn't enough interesting work going on using Ada to warrant investing time in learning the language.
You can help change that -- by doing interesting work! The nice thing about open source and self-directed projects is that you can use what you want based on its own merits, and leave bandwagoneering for when you have to find a job.
That said, I don't really have a strong enough desire to get back into Ada anyway. I'm a big fan of Clojure and Kotlin at the moment :)
The money was about... market rate for the time. Not good, not terrible. Better than taking a job completely outside of my field.
So they'll happily hire anyone with a clearance. If they can't find someone who already knows the language they'll eventually just hire someone who doesn't and let them figure it out on the job. Defense contractors do not pay big bucks for niche skills on legacy maintenance programs. Not to mention, it is some of the most boring work in the industry.
At the time I was a student, and was working as simple designer (AutoCAD) for an architect teacher who just opened his private architecture firm (6 months prior only). But the guy went to the board in question in last day, with a different bid. He proposed them bigger changes, not just renovation of exterior walls, but also design changes of interior space. Now doing that he made them go back to Ministry of Internal Affairs where the entire project instead of being billable as simple renovation, was changes and the entire budget would qualify for a superior plateau inside the Ministry levels of budgets. It jumped the qualification from (roughly estimated for today's $$$) $1M to $5M. And my boss at the time won. For next 6 months I worked my ass in AutoCAD to do all the changes and I am very proud of it even today, as it still stands as is currently.
Now here's your take of my above story. Get interested in their proposals, see what is about the projects and see if they can't actually be helped to jump to a bigger plateau of prices within government. You have the technical expertise, maybe it's time to create your relation expertise as well. They will jump through hoops and all if you bring them something to bill to something much higher their client (the defense department). Then you can really enjoy a bigger pay. Good luck and have fun.
https://www.rollingstone.com/feature/the-stoner-arms-dealers...
At FOSDEM, Ada room has been a continuous presence for more than 10 years, or even longer, as the language still gets quite some use on high integrity computing around this side of the world.
I suspect that you wouldn't agree about the desirability, but I've long thought that doing a simple substitution on some of the terminals in the Ada grammar to turn it into a curly brace language would do a lot for adoption. For someone to do it the right way would mean a tool capable of also doing the reverse substitution on a curly brace text, which would produce output that could be consumed by "legacy" (non-curly brace-aware) compilers. With the rest of the grammar and semantics all staying the same, this would mean a level of fluidity that would allow existing Ada programmers and the programmers working in the hip new "Attica-B"† dialect to work together on the same projects with no more friction than the way that a lot of people already use gofmt.
† Get it?
I use C# at work. I've programmed in Java here and there and have done some small projects in it, but we don't use it at my office. If I apply for a Java job, and the HR rep asks me during the 1st round phone screen if I have Java experience, I'm going to say yes. When I speak with a more technically minded person, I can go into the full story, because they have the background necessary to put it in context.
Companies rarely want to pay for someone to learn on their dime unless there's a specific gain. It typically takes 3-6 months for an engineer to become truly effective and that's with domain knowledge transfer.
Domain experience is valuable and allows speed to get up and running.
I didn't quite understand why someone who wrote a c++ compiler would think Ada was insurmountable - this adds some context.
In my nativité I'd have guessed that writing an Ada compiler was on par with Pascal (but with more types and stuff). This is probably the same (wrong) reasoning by which Mr Bright tricked himself into writing a c++ compiler ;)
Ed: note, I was introduced to Object Pascal - not plain Pascal - so that's the comparison I'm alluding to.
You could knock out an object-Pascal / Oberon compiler in a matter of weeks imo.
On their most up to date variants, Active Oberon and Delphi/Oxygen/FreePascal it will take much longer than just a couple of weeks.
The GNAT Ada compiler is OSS, so you can look it yourself. It has a hand-crafted lexer (for speed), but otherwise it's not complex. It uses recursive descent (for good error messages), but lots of compilers do that & it's not hard to understand either. (If you don't understand creating a recursive descent parser then you'll need to learn that, but it's a one-time cost to learn about that).
Ada is really easy to parse compared to C++. There aren't the backwards-compatible-with-C historical stuff that makes things complicated.
Ada has built-in support for tasks, including safe communication mechanisms for them. Many other languages today do too, so that's not such a big deal today.
Generating very good code is hard in any language. GNAT "cheats" by building on gcc, which already works on this problem. GNAT parses source code & then generates the internal structures needed for gcc to do its thing. Many language implementations parse & then pass things on to an infrastructure (gcc or LLVM), so that's not unusual.
PL/I is complicated in part because of its baroque "automatically figure out all the conversions" rules. Ada in general makes you be explicit about types, so that is a non-issue.
I think you meant "naïveté", what you wrote translates to "nativity" :)
"Dewar personally told me that when implementing the GNAT compiler, whenever they looked at the language specification and thought it might be complicated to implement, they assumed they didn’t understand the language specification and looked for a simpler way to do it. This mindset that “there is probably an easy way to do this” seems to have been different from others, who seemed to assume that complexity was always an inevitable part of the job."
I've been on the losing side of this battle my entire career. While I thought striving for simplicity was core to the job, it's only harmed me. Though it's nice to read about another person who apparently thinks like me.
If any one needs me, I'll in the basement with my stapler, sipping my now cold coffee.
The author of GNU setl has said he would release the source, but we're still waiting. There are binaries here:
(No NetBSD ones though, forcing us to use emulation)
Ada reminds me of spitbol, and setl can be written in spitbol. R K Dewar's spitbol, written in a portable assembly language called MINIMAL, has been open-sourced. There's a version of setl written in spitbol, too. Hopefully we will have the source for setl one day.
The author's dissertation on setl is a favourite of mine:
https://web.archive.org/web/20060823004442if_/http://www.cs....
See also
https://web.archive.org/web/20100217021505if_/http://www.set...
I just used C for a couple of months before being given a copy of Turbo C++ 1.0 for MS-DOS, and since then I only used C when the option was outside of my control.
It already felt primitive in 1992/1993 vs the alternatives, and so far C17 has hardly changed in that regard.
It took me 8 years to get over the initial disgust and learn C++.
But D did get _ embeddable in numeric literals, a very nice feature that D made popular and now it's normal in other languages.
A lot of the older closed compiler are still based around the program library idea which is no longer required, considering GNAT is file / project based. I've only used GNAT and have no idea how the program library versions work.
I'm sad I also purged my DECSystem-10 "Orange Book". I've never been able to find a replacement anywhere.
If it's actually "phone book", then [1] seems promising.
[0] http://www.columbia.edu/cu/computinghistory/pdp10stuff/
[1] http://www.bitsavers.org/pdf/dec/pdp10/TOPS10/1972_PDP-10_Us...
A marvelous find, thanks! I'm glad they haven't all vanished. I'd still like a scan pdf!
https://en.wikipedia.org/wiki/ISO/IEC_8652
I was told that the Ada guyes fought with ISO to have a per paragraph numbering to ease translations and references, ISO (at the time, don't know now) was line numbered, but they lost.
Example 1:
type Byte_Count is range 1 .. 4
with Static_Predicate => Byte_Count in 1 | 2 | 4; -- Aspects are Ada 2012
type Component_Count is range 1 .. 4;
V1 : Byte_Count := 3; -- compiler error: expression fails predicate check
V2 : Component_Count := V1; -- compiler error: requires explicit conversion
For these two types I'm not really concerned about how they are represented by the hardware, but I could if I needed to.Example 2:
Extra constraints added to some pre-defined types:
subtype String8 is String
with Dynamic_Predicate => String8'Length <= 8;
subtype Even_Integer is Integer
with Dynamic_Predicate => Even_Integer mod 2 = 0,
Predicate_Failure => "Even_Integer must be a multiple of 2";
Example 3:Use big-endian for some network packets:
type Packet_Type is record
Header : Header_Type;
Data : Data_Type;
end record;
Low-level representation (placed in the private part of a package spec): for Packet_Type use record
Header at 0 range 0 .. 255;
Data at 0 range 256 .. 1855;
end record;
for Packet_Type'Bit_Order use System.High_Order_First;
for Packet_Type'Scalar_Storage_Order use System.High_Order_First;
for Packet_Type'Size use 232 * System.Storage_Unit;Overall, working with Ada was quite pleasant. The type system is nice. The module system is nice. Writing concurrent code was really nice. The Algol like syntax somewhat reminded me of my day working in Ocaml. I did miss true variant types however.
[1] https://docs.adacore.com/gnat_rm-docs/html/gnat_rm/gnat_rm/r...
* Why did Ada not manage to get a significant foothold outside of some small domains?
* What's great, what's not so great about it?
* How "modern" does the language feel, including the tooling, documentation, etc? Specifically Spark 2014. ( I see a LSP server and VSCode plugin, for example)
* Spark2014 seems to be open source, with a GPLv3 license. Is this what most companies use, or are there significant closed source parts that must be bought? Are most companies still on older versions?
* What other languages are most similar?
1) The creator of #Ada, caracal, once said that when he was in the army, there were two groups of people: i) those who were interested to learn about Ada and ii) those who were totally against it without having seen any of the language at all. The second group were the ones who, when they came around with the green manuals, just refused to even read them.
2) I went back to Ada after burning out in a shitty games company, essentially sitting in a debugger for 19 hours straight isn't good. The only time I have to use a debugger is when using pointers, Ada allows you to avoid pointers for the most part.
Ada's type system, data modelling, it's unparalleled anywhere else ever.
There's not enough people working with Ada in OSS.
It's easy to burn yourself out on a big project sometimes.
3) Very modern, the docs are good, but the tooling is lacking. But then I come from a time of command lines and no package managers.
I have not used it, but it looks promising.
> Why did Ada not manage to get a significant foothold outside of some small domains?
Probably mostly due to licensing issues. Ada has a runtime that you basically have to use and the most complete AdaCore version forces you to release executables under GPL. The FSF version is less complete (many libraries are missing) and allows you to use the much more permissive mGPL version. However, it always lags behind the version from AdaCore and many developers in the past were scared away by the licensing issues.
Other reasons often mentioned:
- Ada has a certain (perceived) background in the US military and aviation industry, which some people don't like.
- Ada is a very complete language and not easy to learn. The syntax is special, in that it specifies each construct on its own and re-uses keywords.
- Overuse of pragmas and "glued on" Unicode string handling
> What's great, what's not so great about it?
Great: It's an extremely fast and safe general systems language suitable for all kinds of programs. It allows high level and extremely low level programming and is suitable for embedded programming.
Not so great: The type constraints for generics are not as expressive as they could be. Aliasing rules ("pointers") are stricter than they would need to be. There are a few oddities with anonymous vs. named types to watch out for.
> How "modern" does the language feel, including the tooling, documentation, etc? Specifically Spark 2014.
Tooling and documentation is excellent, thanks to AdaCore and several good books, as well as the official Ada reference. The language does not "feel" modern, because many libraries are old and appear to be outdated. In reality, old Ada code will just compile and run so there is no need to constantly update and maintain libraries.
> Spark2014
Can't answer that question.
> Are there any close alternatives that are production ready?
The GNAT Ada ecosystem mostly maintained by AdaCore is as production ready as a language could be. AdaCore expect you to buy a commercial license if you're doing safety critical work. As for other compilers, that depends on the vendor and most of them do not support the latest Ada standard.
Yup. See https://www.reddit.com/r/ada/comments/ijwqfl/last_call_on_th...
> Ada has a runtime that you basically have to use and the most complete AdaCore version forces you to release executables under GPL.
See above.
> The FSF version is less complete (many libraries are missing)
Incorrect, AdaCore just packages their libs with their version of the compiler, with FSF, you have to build them yourself, which is a pain. But they are working on that.
> and allows you to use the much more permissive mGPL version.
MGPL hasn't been a thing for at least 10 years now. The FSF version if GPLv3 with linking exception.
> However, it always lags behind the version from AdaCore and many developers in the past were scared away by the licensing issues.
And the cost of licencing from AdaCore. Not small company / startup friendly, but apparently that has changed, but you still have to email them for prices!
> - Ada is a very complete language and not easy to learn. The syntax is special, in that it specifies each construct on its own and re-uses keywords.
This makes no sense, all languages are "complete" to some degree. The syntax is not special, it's like any other, it's defined by a grammar, as are all languages. A lot of languages re-use keywords.
> Incorrect, AdaCore just packages their libs with their version of the compiler, with FSF, you have to build them yourself, which is a pain. But they are working on that.
Various fairly essential libraries maintained by AdaCore are under GPL, so you could not use them for non-GPL software that is distributed. That's what I meant by "incomplete", because the FSF version was traditionally used as the free option for developing distributed, proprietary software. AdaCore has always blocked that by making essential libraries GPL instead of, say, LGPL.
If you used AdaCore it didn't matter, since either you were forced to make your program GPL anyway, or you paid for a commercial license.
> MGPL hasn't been a thing for at least 10 years now. The FSF version if GPLv3 with linking exception.
The question asked was why Ada was not more successful / popular. Your correction just adds more evidence to the licensing confusion. The problem is you can't even be certain it stays a certain way.
> The syntax is not special, it's like any other, it's defined by a grammar, as are all languages.
No, Ada has a rather special grammar in comparison to most other languages, because it specifies every construct on its own, and that is one of the reasons why it is harder to learn than other languages. Grammars for other languages are much more compact and use more shared non-literals.
> all languages are "complete" to some degree
That's not the point. Ada provides much more functionality than most other languages, for example memory alignment for embedded programming and OOP with tagged types. It's as expressive as C++ for systems programming. That's what makes it way more complex than lnaguages like, say, Scheme R5RS, C, or Go. It's easier to learn than C++ but it's much harder to learn than a related language like Pascal or Modula, for instance.
> A lot of languages re-use keywords
Whataboutism? Languages that re-use keywords are generally a bit harder to learn than those with only few constructs and no keyword reuse. You don't think so?
I've never met any Ada programmer before who thought Ada does not have a relatively long and steep learning curve. You'd be the first I've met.
That's not true, the AdaCore libraries are covered by the Runtime Library Exception of GPL and available on GitHub: https://github.com/adacore
And soon available in the package manager: alire.ada.dev
> The purpose of this Exception is to allow compilation of non-GPL (including proprietary) programs to use, in this way, the header files and runtime libraries covered by this Exception.
Make that at least two, I think Ada's pretty easy to learn.
One thing that makes Ada easier is that if you get something wrong, it's usually a syntax error that's caught by the compiler. GNAT's error messages are very good and will often point you the right way. The whole language was designed to try to catch errors at compiler time. Obviously some errors will slip through anyway, but it helps.
Ada does have some features that you have to learn about before you can use them. That's true for any language. E.g., it has a task (thread) system built-in; if you want to use it, you'll need to learn it :-).
* The internet was either practically non-existent, or in its infancy. At that time, getting compilers, documentation, and sample code was much more difficult and time consuming.
* I recall there being a fair bit of criticism about Ada being 'designed by committee' and having a reputation as such.
* C was still shining brightly and overall well-liked. C++ being an improved C, was seen as a very desirable new language for the software development community.
No way you could get your hands on an Ada compiler for MS-DOS in a similar way.
The gnat and base library license confusion has been discussed in the thread.
In addition to that I'm missing a succinct and to the point introduction to ADA. The signal to noise ratio of the standard "programming in ADA 2012" book was freaking me out. I stopped looking into the language not because the language was hard but because it was explained so poorly.
And these days, using Spark, even more bugs could be detected before compilation even succeeds. But no one wanted to use it at any of my jobs, and that knowledge has mostly atrophied from disuse.
Here's extensive research results based on function point analysis. http://www.ifpug.org/wp-content/uploads/2017/04/IYSM.-Thirty...
Whole lotta' mything going on!
https://www.adacore.com/press/adacore-enhances-security-crit...
https://www.adacore.com/press/iso-26262
https://www.adacore.com/press/jtekt-spark-pro-automotive
https://www.adacore.com/press/denso-spark-automotive-researc...
https://www.adacore.com/press/adacore-tools-streamline-devel...
I guess it's mostly the applications its used in, but the language itself has this strict rigidity to it.
It's like the marines or special forces of programming languages or something.
It is very safe language, being both static typed, and strong typed. It was originally a procedural language, but later they added some OO to it. (to folks that don't know what a imperative language is, think of a language where all methods are like Java Static methods, and you store data in some global space).
It can get a bit wordy to program with it, but I also like the lack of '{' bracket use everywhere that C like syntax has. With some modifications, ADA can be transformed into a great/fun language.
Anyway, due to its small echosystem and adoption, I think it will remain a 'defense/aeronautic industry' only type of language.
This is a simple program, and I think it is fairly elegant, but a bit wordy:
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
procedure Check_Positive is
N : Integer;
begin
Put ("Enter an integer value: "); -- Put a String
Get (N); -- Read in an integer value
if N > 0 then
Put (N); -- Put an Integer
Put_Line (" is a positive number");
end if;
end Check_Positive;Note too that {} graphically indicate the open/close in a way that begin/end is another reason not to like begin/end.
https://www.eejournal.com/industry_news/adacores-fifth-annua...
Can anyone comment on memory-management in Ada?
[0] https://github.com/AdaCore/gnatcoll
[1] https://github.com/AdaCore/gnatcoll-core/blob/master/src/gna...
We agree that it's a hole in the current curriculum, that we intend to fill at some stage with the advanced lessons.
State of memory management in Ada is:
- You have a lot of facilities to stack allocate/not heap allocate tons of stuff that you would heap allocate in pretty much any other low level languages.
- When that doesn't cover you, in Ada you're basically at the level of C++: You have refcounted pointers, unique pointers (which are enforced via limited types) in GNATCOLL, managed containers in the stdlib, and manual memory management. You have storage pools which, with the 2012 additions, are roughly similar to custom allocators in C++/Rust.
- In SPARK we have ownership pointer that are roughly similar to pointers in Rust: https://blog.adacore.com/using-pointers-in-spark
Anecdotally, I have a friend/colleague working on a fun side project, https://github.com/Roldak/AGC, meant to plug a garbage collector into Ada, since the language is much more amenable to that than C or C++. (completely prototype/for fun project, hence why I'm not including it in the "serious" options at your disposal above)
with Ada.Text_IO; use Ada.Text_IO;
procedure T is
type T1 is range 16..19;
type T2 is range -7..0;
type R is record
A : T1;
B,C : T2;
end record;
for R use
record
A at 0 range 0 .. 1;
B at 0 range 2 .. 4;
C at 0 range 5 .. 7;
end record;
X : R := (17,-2,-3);
begin
Put_Line(X'Size'Image); -- 8 bits
end T;T1 is a type of integer ranging from 16 to 19 (inclusive). Thus, it can only be four distinct values (16, 17, 18, 19). Two bits is enough to represent these four distinct values and thus the binary representation of the type (in record R) can be reduced to 2 bits.
https://nim-lang.org/ https://nim-lang.org/blog/2020/06/08/static-analysis.html
Many developers would jump through hoops to get any dodgy certification. I have seen dubious FEMA certifications and NFA certifications on some LinkedIn pages.
Sales usually are done as X licenses + at least Y certifications.
The "fn" and ":" are good too.
I'm less sure about "include", because I doubt Ada does textual inclusion. If it does, then that is good too. Otherwise, better choices might be: using, use, require, requires, depend, depends, external, library, unit, module...
It probably also cuts down on human ability, like never taking the training wheels off. In the long run productivity might be lower.
Ada 2012 has 73 reserved words: http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-2-9.htm...
C++ 20 has 97 keywords: https://en.cppreference.com/w/cpp/keyword
In this regard, Ada explicitly had maintainability as a design requirement, and I wonder how well Rust will fare with its concise, symbol-heavy code in that regard.
A few years ago, I wrote a little blog entry about it: https://www.dialectical-computing.de/blog/blog/2011/05/08/de...
Haskell has `Numeric.Natural` but I don't think you can define an integer constrained to a range. It probably goes beyond what the type system can do (statically). I think it's possible with Dependent Types (in Idris) but this is rather new.
For example, if SPARK (Ada subset) is used and absense of runtime errors can be proved by GNATprove, then runtime check generation can be disabled in Ada compiler.
GNATprove generates verification conditions (conjectures) from SPARK code and assertations. Then it feeds these verification conditions to proof tool (Why3, Alt-Ergo, CVC4 or Z3).
(Yes, I know the actual capitalization of my example identifier in JavaScript is "XMLHTTPRequest". That’s what makes it such a good example. :)
C description tends to refer to ALGOL influence, but it just boils down to structured programming and the data types. Syntax has nothing from ALGOL.
MODULE X;
...
END MODULE X.
and Ada's: package X is
...
end X;
Ada's package feels like one statement containing others, whereby Modula's looks like it ends on the first line.https://blog.adacore.com/using-ada-for-a-spanish-satellite-p...
Also I still find the whole environment confusing for windows. GNAT Programming Studio IDE seems to be useful, but what ballpark is the pricing for the commercial version. Anybody has an idea?
1: I suggest FAda :-)
Frankly, that was my first exposure to programming, and I thought the language was strange enough and the prof wasn't good enough, so switched majors. Still the only formal programming education I've had.
What does that sentence even mean?
Built-in concurrency and concurrent-safe data passing: https://learn.adacore.com/courses/intro-to-ada/chapters/task...
Design-by-contract programming: https://learn.adacore.com/courses/intro-to-ada/chapters/cont...
Provably safe programs if you use the SPARK subset of Ada: https://learn.adacore.com/courses/intro-to-spark/chapters/03...
Not compared to Haskell.
Ada has a strong type system for an Algol-derived language, but the world has moved on without it in terms of type systems in general.
But you've got your mind made up already -- please just enjoy your tools, and let others enjoy theirs.
It makes much use of English words rather than symbols. This was intended to maximise readability, even at the expense of writeability. It's not the way most modern languages are designed, sure enough, and I'm not sure it really improves readability, but I'm not especially au fait with Ada so I'm not the best person to comment.
> unintuitive
This strikes me as another way of saying unfamiliar. Forth and Haskell are also extremely unintuitive languages, to people who don't know them, but that's not really much of a criticism.
And then you compare it to C++???