[HN Gopher] Giving Ada a Chance
       ___________________________________________________________________
        
       Giving Ada a Chance
        
       Author : jayp1418
       Score  : 118 points
       Date   : 2021-03-01 13:01 UTC (1 days ago)
        
 (HTM) web link (ajxs.me)
 (TXT) w3m dump (ajxs.me)
        
       | the_only_law wrote:
       | I love Ada, unfortunately it's real world use seems to be
       | relegated to old legacy code. I'd like to use it a little more on
       | the side, but I also need to keep my priorities focused on
       | realism, which sadly means ignoring Ada and learning something
       | like C++ which seems unapproachable from any angle.
       | 
       | Ada also seems to have a weirdly negative rep in many circles it
       | seems. I recall looking around for an Ada compiler for a
       | moderately popular platform and came across and old thread where
       | people didn't give any options but instead just joking about how
       | the OP was interested in such a terrible language. Maybe it's the
       | Pascal/Algol type syntax?
        
         | JNRowe wrote:
         | From my experience, it still gets a lot of use in aerospace and
         | defence companies. Outside of those industries I can't think of
         | people even mentioning it really, but again probably biases
         | abound.
         | 
         | Skimming my local jobs list(SE England) I see new listings from
         | both Airbus and BAE Systems looking for Ada developers in the
         | past week.
        
           | the_only_law wrote:
           | Yeah but I wonder how much of that is new development or code
           | from the 80s-80s they're wanting to port to C or C++
        
             | JNRowe wrote:
             | Again this personal experience only, but one of the
             | projects I'm linked to is a greenfields Ada project.
             | 
             | However, you'd be correct to say there are an _awful_ lot
             | of multi-decade projects in both the companies I
             | mentioned(and the aerospace /defence in general). For
             | example, last year my main project was work stemming from a
             | design that began in 1997.
        
             | Lucretia9 wrote:
             | Apply to nVidia or Toyota then, they have new projects.
        
         | Jtsummers wrote:
         | > people didn't give any options but instead just joking about
         | how the OP was interested in such a terrible language.
         | 
         | I think the attitude is mostly a historical artifact and
         | momentum. The language was soundly rejected in the 80s and 90s
         | by many people in favor of C, for numerous reasons. Some valid,
         | others invalid. It's carried a reputation since then (much like
         | the author's take on Fortran, many quick takes here on PHP and
         | Perl) that reduces the potential for adoption today even though
         | the language is actually rather pleasant (IMHO, and also _now_
         | , may not have been 20 years ago) to work with.
         | 
         | But other languages are better advocated for, and have (mostly)
         | better tooling these days. Alire is helping on the package
         | manager front, but it's still pretty new. When people think
         | "safety" in software they tend to jump straight to Rust and
         | Haskell, mentally, even though Ada also fits within that
         | conceptual space.
        
         | Lucretia9 wrote:
         | >I love Ada, unfortunately it's real world use seems to be
         | relegated to old legacy code. I'd like to use it a little more
         | on the side, but I also need to keep my priorities focused on
         | realism, which sadly means ignoring Ada and learning something
         | like C++ which seems unapproachable from any angle.
         | 
         | Oh, my github must be ancient then!
         | 
         | > Ada also seems to have a weirdly negative rep in many circles
         | it seems. I recall looking around for an Ada compiler for a
         | moderately popular platform and came across and old thread
         | where people didn't give any options but instead just joking
         | about how the OP was interested in such a terrible language.
         | Maybe it's the Pascal/Algol type syntax?
         | 
         | That stems from the hatred from the people working at the DoD
         | at the time who'd never even seen the language.
        
           | the_only_law wrote:
           | Heh, I must say way, impressive GitHub. You the original
           | author of the OSDev wiki's barebones Ada tutorial?
           | 
           | Off topic, but have you ever heard of CHILL? It's a language
           | from the ITU designed for telephone switches (like Erlang)
           | but is supposedly very similar to older Ada standards.
        
         | Tostino wrote:
         | I've never programmed Ada, but I've read pl/(pg)sql are based
         | off it, and those have pretty wide use in their niche. So its
         | principals may live on for quite some time in those other
         | languages.
        
         | andi999 wrote:
         | Lack of a free compiler with permit to use commercially (gnu
         | linker exception), was a problem during a significant phase of
         | the language.
        
           | OneWingedShark wrote:
           | GNAT debuted in 1995, 25 years ago. Some 12 years after the
           | 1983 standard.
        
       | snug wrote:
       | Thought this was talking about blockchain tech, Cardano (Token
       | $ADA) which I'm having a hard time giving a chance. Was hoping
       | something could change my mind
        
         | Tenoke wrote:
         | Why are you having a hard time giving it a chance? Maybe wait
         | until it (Gougen) launches and make up your mind then?
        
           | haskellandchill wrote:
           | Wow, Gougen is one of my heroes, cool to see his name getting
           | recognition.
        
           | threwawasy1228 wrote:
           | They still don't have a smart contract platform launched on
           | the mainnet afaik. The only reason to use it in my mind is as
           | an alternative to Ethereum, NEO, EOS, etc in the smart
           | contract space. Every year that goes by where it does not
           | have it's core competitive feature in a production-ready
           | state is a nail in the coffin from my perspective.
        
             | Tenoke wrote:
             | >They still don't have a smart contract platform launched
             | on the mainnet afaik.
             | 
             | Yes, and that's why I am suggesting to wait ~a month until
             | it is deployed as per the road map before taking a hard
             | stance.
        
               | threwawasy1228 wrote:
               | I've been watching for awhile. The road map said it was
               | going to be out in ~a month, a year or two ago. Excuse my
               | skepticism, but I feel like I've been following the
               | eternally shifting roadmap long enough to warrant it. I
               | like Haskell, I flipped through their Plutus example
               | code, I want to use the product! They should just ship
               | what they have.
        
       | eplanit wrote:
       | A nitpick, but why is Ada in all caps in the title? It isn't in
       | the article, nor is the name an acronym.
        
         | carabiner wrote:
         | @dang Yeah, I don't think this should be in caps. Ada was the
         | woman's name.
        
         | AlgorithmicTime wrote:
         | I thought we were talking about Air Defense Artillery for a
         | minute.
        
         | aleksandrm wrote:
         | Thought this was about accessibility stuff.
        
           | civildude wrote:
           | like c$ADA
        
         | 0xDEEPFAC wrote:
         | Yes, the language is named after Ada Lovelace - a person
         | credited with writing one of the first computer programs. It is
         | not an acronym.
        
         | dang wrote:
         | Hard to say; it was submitted like that. To me ADA means https:
         | //en.wikipedia.org/wiki/Americans_with_Disabilities_Ac..., so
         | I've recased the title above.
        
         | ivan888 wrote:
         | There's no real reason for it to annoy me so much, but I was
         | just thinking about how I can't stand when people seemingly
         | randomly capitalize words relating to technology without the
         | intention of drawing emphasis to them: GIT, NODE, JIRA, JAVA...
         | why??
        
           | forgotmypw17 wrote:
           | I think people sometimes JUST do it for NO good reason other
           | than to DRAW emphasis
        
           | nerdponx wrote:
           | I think people sometimes like to imagine that these things
           | are acronyms even though they aren't.
        
           | joshuaissac wrote:
           | In the case of Jira, it was in the past officially stylised
           | by Atlassian as JIRA.
        
         | zdragnar wrote:
         | Probably an autocorrect; the language is less commonly used
         | than the Americans with disabilities act.
        
           | Koshkin wrote:
           | This drives me crazy: whenever I type 'emacs' on my iPad, I
           | get 'emasculated' (and the iPad keeps insisting on it even
           | when I try to correct the word).
        
       | nofunsir wrote:
       | No mention of FAA's DO-178C or Green Hills Integrity-178 RTOS?
       | Green Hills's IDE is named after Ada[1].
       | 
       | [1] https://ghs.com/products/AdaMULTI_IDE.html
        
         | okl wrote:
         | RTCA DO-178 is language agnostic.
        
       | TomMasz wrote:
       | I took an Ada programming course when I worked at a defense
       | contractor in the late 80s. Coming from C and Pascal it seemed
       | familiar enough to learn quickly but was overkill for what we
       | were doing at the time. I left soon after and I have no idea if
       | they ever actually adopted it.
        
       | pdq wrote:
       | Ada, not ADA.
        
       | protomyth wrote:
       | I tend to like Ada, but it is a tiring language to read with the
       | all caps. Also, it 'feels' like it has a gatekeeper group and
       | really doesn't come up in any mobile conversation. I still
       | believe someone will do something akin to a syntax substitution
       | and come up with a well liked language.
       | 
       | Also, modern Fortran is not that bad of a language much like the
       | modern parts of C++.
        
         | Lucretia9 wrote:
         | All caps haven't been a part of the language since Ada83, go
         | check the follow up spec, Ada95. Maybe you're thinking of
         | Niklaus Wirth's languages, the Modula's and Oberon?
        
         | henrikeh wrote:
         | > [...] tiring with the all caps.
         | 
         | I guess there is more to like then, since the keywords are case
         | insensitive. The OP doesn't even use all caps.
        
           | protomyth wrote:
           | Odd, that was what I was told by our Ada teacher, and the
           | book has all caps.
        
             | coliveira wrote:
             | Some people prefer all caps for keywords, just like they do
             | nowadays on SQL code. But the language is case insensitive,
             | you can choose otherwise.
        
             | henrikeh wrote:
             | It is indeed a common misconceptions, but here is the
             | official Ada 83 Language Reference Manual on the subject: h
             | ttp://archive.adaic.com/standards/83lrm/html/lrm-02-09.html
             | ...
             | 
             | > Reserved words differing only in the use of corresponding
             | upper and lower case letters are considered as the same
             | (see 2.3).
             | 
             | Interestingly, the manual itself doesn't even use upper
             | case:
             | 
             | > For readability of this manual, the reserved words appear
             | in lower case boldface.
             | 
             | So even the Ada standard recognizes the upper case is less
             | readable and undesired.
             | 
             | Case insensitivity also applies to identifiers (variable
             | names, type names etc.) (sec 2.3) and that is a definitely
             | an archaic feature, but the GNAT compiler has the helpful
             | -gnatya style check which enforces the Pascal_Case style: h
             | ttps://gcc.gnu.org/onlinedocs/gcc-4.6.4/gnat_ugn_unw/Style-
             | ...
             | 
             | ---
             | 
             | Another common misconception is that function/procedure
             | names (designators) must appear after the `end`. That is
             | optional:
             | 
             | > If a designator appears at the end of a subprogram body,
             | it must repeat the designator of the subprogram
             | specification. http://archive.adaic.com/standards/83lrm/htm
             | l/lrm-06-03.html...
        
         | Jtsummers wrote:
         | The community is definitely not helping, or has not helped. It
         | seems to be improving but I've seen a lot of negative responses
         | to novices that read like some of the things I saw in the 00s
         | when trying to get into Common Lisp. Some individuals are
         | willing to push past this, for others it's a deal breaker.
         | 
         | The community is becoming more open (AdaCore has been very
         | helpful here), I think, but you still have a fair amount of
         | vocal gatekeepers that are going to continue to keep people out
         | (deliberately or not).
        
         | jhbadger wrote:
         | The tradition of all caps keywords (just a convention, not
         | required as others have noted) was common in most languages in
         | the era before most editors had syntax highlighting. It wasn't
         | meant to be "tiring" but rather the opposite, to make reading
         | code easier. Of course modern syntax highlighting makes the
         | convention obsolete.
        
       | thesuperbigfrog wrote:
       | I like the "clean feel" of Ada's syntax: it combines the elegance
       | of Python with a bit more structure and does not suffer from
       | Python's significant whitespace issues.
       | 
       | The so-called "Ada comb" structure that is used for packages,
       | subprograms, and even declare blocks makes it easy to find what
       | you are looking for because it makes the source code more
       | regular.
       | 
       | The "Ada comb" is formed by the shape of the source code with the
       | subprogram header / declare, begin, exception, and end forming
       | the "teeth" of the comb and the rest of the source code indented
       | between the "teeth":
       | 
       | function Square_Root (Arg : Float) return Float is
       | -- local variables declared here
       | 
       | begin                   -- program work here
       | 
       | exception                   -- exception handling here
       | 
       | end Square_Root;
        
         | linuxlizard wrote:
         | I did Ada back in university. I wrote a toy Ada compiler for my
         | master's thesis. I was so enamored with Ada's exception
         | handling at the time! When I discovered Python and its similar
         | exception handling, I jumped onto Python in a heartbeat.
        
           | OneWingedShark wrote:
           | Awesome, you wouldn't still have a copy of your Ada
           | compiler's source do you?
        
         | cafard wrote:
         | I use PL/SQL a fair bit, which was inspired by Ada.
         | Unfortunately, the designers did not bring over
         | 
         | ShortName is New ReallyLongAndAwkardName;
         | 
         | Ah, well.
        
           | OneWingedShark wrote:
           | > I use PL/SQL a fair bit, which was inspired by Ada. I have
           | a bit of a project-idea here: PL/SQL+Ada+VHDL all together in
           | an IDE.
           | 
           | > Unfortunately, the designers did not bring over > ShortName
           | is New ReallyLongAndAwkardName; Do you mean renames? Package
           | Text renames Ada.Strings.Fixed;
           | 
           | IIRC, RENAME is in the keywords list for PL/SQL.
        
         | wott wrote:
         | > The so-called "Ada comb" structure that is used for packages,
         | subprograms, and even declare blocks makes it easy to find what
         | you are looking for because it makes the source code more
         | regular.
         | 
         | "Declare" blocks are a PITA. I don't mean the declaration part
         | in the subprogram example you quoted (that's fine), but having
         | to use explicit "declare" blocks to create new variables in the
         | scope of a loop or a conditional. You can't just declare
         | variables after the introducing keyword (then, loop, ...),
         | possibly between it and a "begin" that would be fused to be
         | come a part of the loop/conditional syntax. You have to use a
         | separate "declare" block, with its "begin" and its own "end;",
         | and then you still have to have the "end loop;"/"end if;" of
         | the loop/conditional itself.
         | 
         | Illustration.
         | 
         | A normal conditional:
         | 
         | ---------
         | 
         | if A = 5 then                 B := 7;            C := A + 1;
         | 
         | end if;
         | 
         | ---------
         | 
         | What you'd think you could at least do (it would already be a
         | bit heavy, but by Ada standard verbosity it would be a good and
         | smooth fit):
         | 
         | ---------
         | 
         | if A = 5 then
         | 
         | declare                 D : natural;
         | 
         | begin                 B := 7;            D := 1;            C
         | := A + D;
         | 
         | end if;
         | 
         | ---------
         | 
         | What you actually need to do:
         | 
         | ---------
         | 
         | if A = 5 then                 declare              D : natural;
         | begin              B := 7;              D := 1;              C
         | := A + D;            end;
         | 
         | end if;
         | 
         | ---------
         | 
         | So you waste one indentation level more each time you add one
         | such declare block. Talking about combs, this get hairy quickly
         | even when you have simply a few nested loops/conditionals.
         | 
         | Also, the "end;" of the "declare" block is not an "end
         | declare;" or "end block;" like you have "end if;" and "end
         | loop;". So that make it a bit harder again to know where you
         | are when you are closing your blocks/loops/conditional.
         | 
         | Then you can add a label, but that make it even heavier (and
         | good luck finding a clever name for the block label each time).
         | Not sure there exists a good solution to place the (opening)
         | label. And the closing label comes at the same place a closing
         | keyword, which may be considered a bit confusing.
         | 
         | ---------
         | 
         | if A = 5 then                 myblock:            declare
         | D : natural;            begin              B := 7;
         | D := 1;              C := A + D;            end myblock;
         | 
         | end if;
         | 
         | ---------
         | 
         | or
         | 
         | ---------
         | 
         | if A = 5 then                 myblock: declare              D :
         | natural;            begin              B := 7;              D
         | := 1;              C := A + D;            end myblock;
         | 
         | end if;
         | 
         | ---------
         | 
         | or
         | 
         | ---------
         | 
         | if A = 5 then                 myblock:              declare
         | D : natural;              begin                B := 7;
         | D := 1;                C := A + D;              end myblock;
         | 
         | end if;
         | 
         | ---------
         | 
         | The last one, which wastes not only 1, but 2 indentations
         | levels(!), and even worse, creates an indentation gap in the
         | end, happens to be the recommended style...
        
           | Jtsummers wrote:
           | HN formatting tip: Put two extra spaces in front of each of
           | those code blocks and remove all those unnecessary blank
           | lines and you're comment will be tolerably formatted. As it
           | is, it's a PITA to read because it spans several screens
           | without any good cause.
        
         | [deleted]
        
       | iamevn wrote:
       | > I can't help but think that complicated programming paradigms
       | would seem more intuitive to beginners if taught through Ada
       | instead of C and its derivative languages, as is common in
       | computer science and engineering faculties worldwide.
       | 
       | At my university, the first courses you took in CS used Ada. I
       | think it was a really good choice but I was in the minority I
       | guess because after my year they switched to either using Java or
       | Python depending on who taught which of the courses in that first
       | series.
       | 
       | People found it frustrating how much work it'd take to get their
       | programs to even compile but that's a good thing in my view. If
       | it wasn't compiling, that was normally because the compiler found
       | an error that would still be there at runtime in another
       | language.
        
         | bee_rider wrote:
         | I help beginner python students. Python might be a nice easy
         | scripting language for bashing out NUMPY scripts, but I'm
         | beginning to suspect it is terrible for teaching. The "what
         | type is this variable, and will this function automatically
         | convert it for me" game is not very fun at all for beginners.
        
         | d3ntb3ev1l wrote:
         | Ada was also taught at my Comp Sci program back in 1987
        
         | jandrese wrote:
         | When I went to school the instructor talked a bit about Ada,
         | but as far as I know there weren't any compilers available that
         | mere students could afford. This was in the mid-90s.
         | 
         | I remember doing a bit of comparison of the syntax between
         | languages, and Ada's lack of anything like a switch/case
         | statement stood out, but the instructor did talk up the idea
         | that if you could get it to compile it would run in Ada,
         | assuming you didn't hit a compiler bug. Apparently getting the
         | compilers working properly was a problem at the time.
        
           | Lucretia9 wrote:
           | I was at uni in 1995, they used gnat 3.15p.
        
           | Jtsummers wrote:
           | I don't know when it was added, but Ada does have a
           | switch/case equivalent construct and I can't imagine it
           | wasn't available early on.                 case X is
           | when 1 => ...;         when 2 => ...;         when 3 | 4 |
           | 100 => ...         when others => ...       end case;
        
             | okl wrote:
             | It was always part of the language, http://archive.adaic.co
             | m/standards/83lrm/html/lrm-05-04.html...
        
               | jandrese wrote:
               | I have no idea what my professor was on about then. I
               | remember him showing a slide of this ridiculous looking
               | if/then/elseif... chain compared to a C switch statement.
        
         | ksec wrote:
         | I am not sure if this is still the case today, but Computer
         | Engineering in EE Department used to teach Pascal / Ada / C as
         | the first programming language. With the expectation that
         | making a program to compile correctly is hard. Before you move
         | off to something like Perl / Java / Python.
         | 
         | While in CS they tends to start to Python or Java. And you
         | start learning all the OO, Procedure or whatever paradigm
         | before going into Web or other area of development with PHP.
         | Where you get some results earlier.
         | 
         | I used to think EE way of teaching sucks. Old fashioned, not
         | following the industry trend. Boring. Teaching you about OSI
         | Models while CS students were already having some fun with the
         | higher level Web Development.
         | 
         | Now I tend to think EE's way is far better.
        
           | mmcdermott wrote:
           | I feel this. My CS program was in Java.
           | 
           | After a few years in industry, I believe that CS should start
           | with either C or Scheme. C to teach you about real machines,
           | Scheme to ignore the machine and do math (algorithms).
        
             | cgh wrote:
             | I get what you're saying, but learning C teaches you about
             | the C memory model instead of "real machines". C was
             | designed for portability across different architectures
             | and, believe it or not, was considered high-level and
             | abstract at one time.
             | 
             | But I agree that learning C is valuable because I believe
             | that learning about manual memory management is valuable.
        
               | Kototama wrote:
               | > But I agree that learning C is valuable because I
               | believe that learning about manual memory management is
               | valuable.
               | 
               | You need to do it in Ada too :-)!
        
               | OneWingedShark wrote:
               | >I get what you're saying, but learning C teaches you
               | about the C memory model instead of "real machines". No.
               | C doesn't do that, not at all; see:
               | https://queue.acm.org/detail.cfm?id=3212479 If you want
               | to get to the down and dirty, and quickly, without nearly
               | all the "Gotcha!" inherit in C, FORTH is the way to go.
               | 
               | >C was designed for portability across different
               | architectures Absolute bullshit. This is a claim that has
               | been going on for far too long, the whole "portable
               | assembler" myth. IEEE694-1985 is a portable assembler,
               | hell read "Using a high level language as a cross
               | assembler" ( DOI: 10.1145/954269.954277 ), for that
               | matter.
               | 
               | >and, believe it or not, was considered high-level and
               | abstract at one time. The "gotcha!"-factor was
               | increasingly ignored when I was learning about computer
               | languages, but I had an advantage in having my first
               | language be Turbo Pascal and self-taught using the manual
               | and compiler.
               | 
               | > But I agree that learning C is valuable because I
               | believe that learning about manual memory management is
               | valuable. That's doable much easier in Ada, Forth, or
               | BLISS. C is becoming more and more of a liability, to the
               | point I would say that it has no real value in any
               | professional setting, and an incredibly limited one in
               | the academic.
        
               | mmcdermott wrote:
               | And that's fair. I tend to view C as high-level assembler
               | which does mean some loss of fidelity from pure assembly.
               | It seems like a case of being "close enough", I suppose,
               | because switching to pure assembly would make it a lot
               | harder to cover the subject matter in a standard
               | semester.
        
         | Lucretia9 wrote:
         | A lot of Universities and company's were bribed by Sun to start
         | using Java.
        
           | SeanLuke wrote:
           | Do you have any evidence for this? As an early university
           | adopter, I sure would have liked to know how to get in on
           | that sweet Java bribe money.
        
         | ardit33 wrote:
         | what school did you go to? My university (Radford) did teach
         | Ada as well the first year, way back in 1999, and switched to
         | Java after it.
         | 
         | I liked Ada a lot, but Java gave me employment after school.
        
         | throwawayboise wrote:
         | > after my year they switched to either using Java or Python
         | 
         | They do this because of intense negative feedback from students
         | who don't like having to learn languages for which there is no
         | job market.
        
           | mmcdermott wrote:
           | Which is fair, but also kind of funny. In theory, what most
           | of us do day to day is software engineering and computer
           | science is a niche corner of mathematics. But the broader
           | expectation is that the math-niche teaches day to day
           | programming.
        
           | iamevn wrote:
           | I'm not sure this was the case for us, there were plenty of
           | other courses in the major that involved both widely used
           | language and more niche ones.
           | 
           | I think it was more that we didn't have enough professors who
           | were bought-in to Ada to handle the volume of students in
           | those initial courses. The professor who used to teach all
           | the intro courses (and was the biggest advocate for Ada
           | there) became the department chair and let other people take
           | over those courses so he could focus what time he had on some
           | of the upper level courses. Pretty sure they still use Ada in
           | their concurrent programming course too.
           | 
           | Edit: Got curious and I think this is all the languages I
           | used as part of an undergrad CS degree in approximately the
           | order I first used them:
           | 
           | Ada, Racket, C, Make, x86 ASM, Java, Bash, batch script, PHP,
           | JavaScript, MySql, Python 2, Inform 7, Blender Game Engine
           | visual scripting, ICON, Lua, Erlang, and ROBOTC
           | 
           | I'm honestly surprised how much variety there was despite the
           | only academic language being Racket.
        
         | MaxBarraclough wrote:
         | > People found it frustrating how much work it'd take to get
         | their programs to even compile
         | 
         | Makes sense if they're students working on small projects. Ada
         | is explicitly designed to make large programs readable, and
         | willingly trades off on writeability when the two come into
         | conflict. It isn't going to shine if you're writing small
         | 'single shot' applications, that isn't what Ada is for.
         | 
         | (Ada also commits to using many English language words where
         | languages like C use symbols. SQL does this too. I'm not sold
         | on the idea that this improves readability. Of course, there's
         | far more to Ada than the skin-deep matter of its wordy syntax.)
         | 
         | This is similar to the readability/writeability tradeoff of
         | moving from JavaScript (more writeable) to TypeScript (more
         | readable and more refactorable). See the current discussion
         | thread at [0].
         | 
         | Interesting reading (for some of us at least): the original Ada
         | design rationale document, from 1986 [1].
         | 
         | [0] https://news.ycombinator.com/item?id=26314756
         | 
         | [1] https://apps.dtic.mil/dtic/tr/fulltext/u2/a187106.pdf
        
       | coliveira wrote:
       | Ada syntax is closely related to Pascal and Algol. If you like
       | these languages, then you will enjoy Ada. Unfortunately many
       | people prefer the tenseness of C++.
        
       | butterisgood wrote:
       | Ada shouldn't be all caps I don't think.
       | 
       | (I always expand that to the American Dental Association)
        
         | Kototama wrote:
         | Except if you access the website through the TOR network.
        
         | stsmwg wrote:
         | Or the Americans with Disabilities Act.
        
           | Lucretia9 wrote:
           | Or Australian...
        
             | OneWingedShark wrote:
             | Americans with Disabled Australians?
        
         | jkw wrote:
         | Or Cardano
        
         | Tomte wrote:
         | I suppose the HN software changed it and the submitter didn't
         | notice (or didn't care). It happens silently after submitting,
         | unlike the "13 too long" message that blocks submission.
         | 
         | Many of those rewrites are benign, even good, many others are
         | stupid and infuriating.
         | 
         | Unfortunately there is no way to have yourself declared to be a
         | "well-known submitter with a history of not editorializing or
         | outrage-optimizing submission titles" and get this thing
         | switched off.
         | 
         | In this case there have been so many discussions and
         | submissions about the American with Disabilities Act that it
         | sounds plausible to be such an automatic rewrite.
        
       | drannex wrote:
       | > the Lovecraftian hieroglyphics of Fortran's various eldritch
       | incarnations.
       | 
       | This is one of the best lines I've read in awhile, gave me a good
       | chuckle. Thanks for that.
        
       | [deleted]
        
       | roland35 wrote:
       | I went to a summer program at the US Air Force Academy and took a
       | short class using Ada with Lego mindstorm robots. Having never
       | done any programming at the time beyond BASIC (thanks to QBASIC
       | and my TI-83+ calculator), I really enjoyed learning Ada. The
       | instructor talked about the safety aspect of Ada which went over
       | my head at the time :)
       | 
       | I have done a lot of embedded programming in C over the years and
       | while the reality is most embedded programmers know C best, I am
       | starting to think we would be better served to try a new language
       | with better features such as Ada or Rust. C++ is nice as well,
       | but has it's own set of problems when used for embedded
       | programming.
        
         | kevin_thibedeau wrote:
         | Nim has some influence from Ada in its type system and has much
         | of the same feeling that the language is a power tool at your
         | disposal. They have been making changes to make it useful
         | without GC for embedded targets.
        
       | walshemj wrote:
       | " Lovecraftian hieroglyphics of Fortran's various eldritch
       | incarnations."
       | 
       | I take it the Author hasn't seen any APL code.
        
       | Sniffnoy wrote:
       | > The writing is on the wall: Ada is here to stay.
       | 
       | OK, this has no relation to the actual content of the article,
       | but I have to point out that that is not what the phrase "the
       | writing is on the wall" means.
        
         | UncleOxidant wrote:
         | In the original biblical usage a Babylonian king held a feast
         | and suddenly a disembodied hand wrote: MENE, MENE, TECKEL,
         | PARSIN on the wall, which translated to:
         | 
         | "Mene: God has numbered the days of your reign and brought it
         | to an end."
         | 
         | "Tekel: You have been weighed on the scales and found wanting."
         | 
         | "Peres: Your kingdom is divided and given to the Medes and
         | Persians."
         | 
         | So you're right, it doesn't connote that something will endure,
         | but that something will end.
        
       | superbcarrot wrote:
       | I have so many languages on the "give it a chance" list that I
       | don't know where to start.
        
         | foerbert wrote:
         | If it helps make up your mind at all, I was much the same the
         | way until I ended up trying Ada. After a night bashing my head
         | against the compiler... well now every time I see a new
         | language pop up I quickly check a few of the features I've
         | become too attached to from Ada and usually* leave in
         | disappointment.
         | 
         | You can decide for yourself if this is an endorsement or a
         | warning. Or both.
         | 
         | *Exceptions obviously exist for very different niches or
         | paradigms.
        
           | Lucretia9 wrote:
           | Yeah, ranges and modular types for me, without them data
           | modelling is hindered severely.
        
       | ajdude wrote:
       | This was a good read. I instantly recognized the title of the
       | textbook that is mentioned in the blogpost? I own it!
       | 
       | Having a background in C, I went back and forth with Ada for
       | years, without really jumping all in. In the last couple years in
       | particular, with the growing popularity of Rust, I started to
       | renew my interest.
       | 
       | I'm reminded of a popular reddit thread on r/Ada-- someone called
       | Rust a "toy language", which prompted the valid response that
       | Rust is being used in a lot of commercial products lately. The
       | response[0] kind of brings home the caliber that Ada is capable
       | of, starting with: > Rust being used in commercial products isn't
       | really the same ballpark as what I'm talking about. It's not even
       | the same game.
       | 
       | It seems like the easiest way to trend on HN is to make a post
       | such as "<old software> rewritten in Rust", but each time I see
       | more and more people advertising Rust, I just wonder why Ada
       | didn't get the credit it deserved as being absolutely
       | bulletproof. Eventually, I came across an "Ada Manifesto" of
       | sorts [1] that finally pushed me to "put my money where my mouth
       | is" and start going all in with the language. (the same author of
       | that "Manifesto" maintained a "Should have Used Ada"[2] series
       | for a while that points out just how using Ada could have stopped
       | certain security vulnerabilities from ever being a problem in the
       | first place)
       | 
       | Ada is anything but dead and there's a lot of interesting things
       | coming out for the 202x specification. I hope to see community
       | enthusiasm grow as people begin to shift their interest more and
       | more to safe languages.
       | 
       | [0]:
       | https://old.reddit.com/r/ada/comments/js6edd/regarding_this_...
       | [1]:
       | https://old.reddit.com/r/ada/comments/7p12n3/going_allin_wit...
       | [2]: https://annexi-strayline.com/blog/
        
         | trott wrote:
         | > I just wonder why Ada didn't get the credit it deserved as
         | being absolutely bulletproof
         | 
         | It's not. All languages make trade-offs in the performance-
         | convenience-safety-etc space, and Ada's choice is not "100%
         | safety". It lacks memory safety and has holes in its type
         | system: https://www.enyo.de/fw/notes/ada-type-safety.html
        
           | Lucretia9 wrote:
           | You can write massive programs without a pointer in sight. If
           | you have to import any C, then it's made a lot worse. You're
           | better off doing memory mapped register type stuff in Ada.
        
           | foerbert wrote:
           | I wouldn't say Ada lacks memory safety. It doesn't go for
           | 100%-in-all-cases but neither does Rust. The main differences
           | are that it doesn't do memory safety by default (which is
           | significant), and also treats memory safety with less
           | granularity.
           | 
           | Aside from simply making manual memory management less
           | frequent (with things like variably sized arrays), it has
           | memory pools and subpools to handle more large-scale memory
           | safety issues. Essentially you can define the scope for all
           | allocations of a type.
           | 
           | It's an interesting tradeoff, though unfortunately I haven't
           | seen much discussion about it.
        
             | erik_seaberg wrote:
             | I think it's time we start expecting 100% as table stakes,
             | because any flaws are catastrophic. Moore's Law has more
             | than paid for it; Android could run an animated display and
             | a Bluetooth stack in a _wristwatch_ seven years ago.
        
         | [deleted]
        
         | mcculley wrote:
         | Is Unchecked_Deallocation still necessary? If so, then it is
         | hard for me to take seriously any claims of Ada's safety.
        
           | OneWingedShark wrote:
           | There's a LOT of things that it's not necessary for; watch
           | this video:
           | https://archive.fosdem.org/2016/schedule/event/ada_memory/
        
       | kibwen wrote:
       | In answer to what appears to be a misunderstanding about Rust:
       | 
       |  _> Its foreign function interface seems particularly poorly
       | implemented. The official Rust documentation suggests the use of
       | the external third-party libc library (called a  'crate' in Rust
       | parlance) to provide the type definitions necessary to interface
       | with C programs. As of the time of writing, this crate has had 95
       | releases. Contrast this with Ada's Interfaces.C package, which
       | was added the language in Ada 95 and hasn't needed to change in
       | any fundamental way since._
       | 
       | Rust's libc crate isn't third-party, it's first-party, developed
       | by the Rust project itself: https://github.com/rust-lang/libc/ .
       | It's also not just for type definitions necessary to interface
       | with C programs; here's the first heading and first paragraph of
       | its README:
       | 
       |  _" libc - Raw FFI bindings to platforms' system libraries"
       | 
       | "libc provides all of the definitions necessary to easily
       | interoperate with C code (or "C-like" code) on each of the
       | platforms that Rust supports. This includes type definitions
       | (e.g. c_int), constants (e.g. EINVAL) as well as function headers
       | (e.g. malloc)."_
       | 
       | The fact that this library contains low-level type definitions
       | for every platform that Rust supports explains why it's had more
       | than one release: new platforms get added, platforms add new
       | interfaces, and platforms change the definitions of existing
       | interfaces (possibly incompatibly, which explains why this isn't
       | in the standard library).
       | 
       |  _> It lacks basic features necessary for the task, like
       | bitfields, and data structure packing._
       | 
       | The latter is achieved via the built-in `repr(packed)` attribute
       | (https://doc.rust-lang.org/nomicon/other-reprs.html#reprpacke...)
       | and the former is provided by the bitflags crate:
       | https://crates.io/crates/bitflags (while unlike libc this does
       | not live under the rust-lang org on Github, it does live under
       | its own org which appears to be populated exclusively by Rust
       | project team members).
        
         | [deleted]
        
         | aw1621107 wrote:
         | > the former is provided by the bitflags crate:
         | https://crates.io/crates/bitflags
         | 
         | The linked crate appears to implement an unrelated feature.
         | c2rust-bitfields [0] or rust-bitfield [1] might be better
         | examples.
         | 
         | Rust's working on adding native support for bitfields, but it
         | seems that that might be a while out at this time [2, 3]
         | 
         | [0]: https://crates.io/crates/c2rust-bitfields
         | 
         | [1]: https://github.com/dzamlo/rust-bitfield
         | 
         | [2]: https://github.com/rust-lang/rfcs/issues/314
         | 
         | [3]: https://github.com/rust-lang/rfcs/pull/3064
        
       | UncleOxidant wrote:
       | I really like Ada's ranged types (VHDL has them also - it
       | inherited them from Ada). You can say:                   type
       | OperatingTemp is range 33 .. 90;
       | 
       | And then declare variables of that type and they will be range
       | checked - an exception will be thrown if the variable goes out of
       | that range. Wish more languages had this feature.
        
         | the_only_law wrote:
         | I have little knowledge of HDL's but I'm constantly hearing bad
         | things about Verilog and good things about VHDL. Is it worth
         | picking up?
        
         | hasperdi wrote:
         | In JavaScript it is possible to define getter and setter method
         | of an object. So this behaviour can be emulated by adding a
         | validation in the setter method.
         | 
         | https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...
         | 
         | In Java too, don't know about other languages though...
        
           | Jtsummers wrote:
           | Right, it's emulated but not universal or built-in. Nothing
           | in JavaScript will enforce using getters/setters, it's 100%
           | up to programmer discipline or adding a linter (if any linter
           | has this as an option) to ensure both the creation of the
           | accessors and their use.
           | 
           | The benefit of this in Ada is that it is universal, and it
           | requires the programmer to do nothing special later on except
           | to not turn off the runtime checks. Using that above example,
           | this would be a runtime error:                 Reading :
           | Integer := Get_A_Reading(...); -- In some run Reading gets 0
           | for some reason       Temperature : OperatingTemp;
           | ...       Temperature := OperatingTemp'Value(Reading); --
           | runtime error in Ada if Reading is invalid
           | 
           | And because OperatingTemp is a distinct type, you never even
           | have the option to do:                 Temperature :=
           | Reading; -- doesn't compile
           | 
           | Also, in most OO languages where you'd make temperature an
           | internal, private variable you can prevent _external_ users
           | of the class from interacting with it incorrectly, but you
           | can 't control _internal_ users. Consider this Java-ish
           | example:                 class Thermostat {         private
           | int temperature; // should only be in [33,90]         public
           | void SetTemperature(int value) { // check range and set }
           | public void AnotherMethod(int value) {           // good
           | discipline would be:           SetTemperature(f(value));
           | // but it's not strictly required so this is also allowed
           | temperature = f(value);         }       }
        
           | goatinaboat wrote:
           | _In JavaScript it is possible to define getter and setter
           | method of an object_
           | 
           | If a civil engineer had access to concrete but he chose to
           | build with mashed potato instead he would be considered
           | insane. Yet programmers with access to Ada choose JavaScript
           | and it's considered perfectly normal.
        
           | n30phyte wrote:
           | Basically any language with objects and methods can do this
        
             | nradov wrote:
             | Sure, although in languages like Java that lack operator
             | overloading the syntax gets messy.
        
         | drfuchs wrote:
         | Ranged types are directly from Pascal. You can also use them to
         | specify the valid indexes for an array (so a given array might
         | be zero-based, or one-based, or 1900-based, or even
         | -32768-based). A very positive feature, I agree.
        
           | Jtsummers wrote:
           | And, even better, arrays in Ada (can't speak to Pascal) can
           | be _any_ discrete type so long as it is a range:
           | type Character_Histogram is Array (range 'A'..'Z') of
           | Integer;       -- syntax may be off, not enough practice to
           | do this cold right now
        
             | FpUser wrote:
             | type         TPerson = record           name: string;
             | age: integer;         end;         TThrteenPersons =
             | array[10..22] of TPerson;            procedure Check(const
             | aPerson: TPerson);       var         vPerson:
             | TThrteenPersons;       begin         vPerson[11] :=
             | aPerson; // this is ok         vPerson[1] := aPerson; //
             | this one gives compile error       end;
             | 
             | alternatively if runtime range checking is on then
             | vPerson[i] = aPerson will raise the exception if i is out
             | of range
        
               | Jtsummers wrote:
               | Right. I know it works with numeric indexes in Pascal. My
               | point was that (using my previous example) in Ada it
               | works with any discrete type, in that case characters
               | (which are not numbers in disguise in Ada) so I can do
               | this:                 Histogram : Character_Histogram;
               | ...       Histogram['A'] := Histogram['A'] + 1;
               | 
               | (Ok, a bit more work because I didn't initialize the
               | histogram to 0.)
        
               | kwhitefoot wrote:
               | It works with any ordinal type in Pascal, including
               | characters, booleans and enums.
        
               | Lucretia9 wrote:
               | Square brackets are coming, so you'd have to use ('A')
        
               | Jtsummers wrote:
               | Hah, I've been in Go lately so my brain defaulted to the
               | wrong thing in that example.
        
               | FpUser wrote:
               | Pascal (well Delphi/FreePascal incarnation) also works
               | with chars and enums.
               | 
               | This modern pascal is very feature rich and has plenty of
               | fancy bells and whistles.
        
               | drfuchs wrote:
               | Wirth's original, standard Pascal allowed for
               | int/char/bool/enum, and ranges thereof, as array bounds;
               | it wasn't a Delphi enhancement.
        
               | FpUser wrote:
               | I am sure it was. I am just not familiar with it hence
               | specified the one I know.
        
             | kwhitefoot wrote:
             | In Pascal you can use any ordinal type as the type of the
             | array index. You can create a new type from a range of
             | ordinal values.
             | 
             | So you can have arrays where the index runs from -10 to +20
             | or from +7 to +26 for instance. Booleans are also ordinal
             | types so you can have an array where the index is boolean.
        
             | Avshalom wrote:
             | I don't think it even needs to be a range, you can index
             | using enums
        
               | Jtsummers wrote:
               | Well, "range" was not the correct term. What I meant is
               | that you can't treat the source as sparse. You can't skip
               | portions of it. So you can't make an array that only
               | covers every other element of this enumeration:
               | type Colors is (Red, Green, Blue, Black, Gray, White);
               | 
               | It has to be a consecutive group of them, taken in order,
               | as the specification of even this enumeration has an
               | ordering to it as far as Ada is concerned. So I can make
               | an array using all of Colors as the index, or some subset
               | but it has to be, say, Red..Blue and not Red|Blue
               | skipping over Green.
        
               | Lucretia9 wrote:
               | Ada 2012 allows you to define gaps, this is my best
               | example I have available
               | https://github.com/Lucretia/sdlada/blob/master/src/sdl-
               | video...
        
               | Jtsummers wrote:
               | That is great to read, and probably a sign that my
               | learning materials should be updated. I'll try to
               | remember this in the future.
        
         | throwaway894345 wrote:
         | I agree. I learned Ada in university (my professor was on the
         | Ada committee) and used it for an embedded development course.
         | The language was really good (many fewer foot guns than C or
         | C++; clearly Ada was holistically designed), but I recall
         | having issues with the tooling and the ecosystem, and the
         | community was _super_ defensive and hostile. If something wasn
         | 't working for your use case and the community didn't have a
         | solution, then your use case was invalid. If you politely asked
         | for help, you were incompetent or too lazy to figure it out on
         | your own. This was a decade ago, so maybe things have changed
         | since, but I can honestly understand why the language is niche.
         | The type system and other intra-language features are very
         | interesting but ultimately not the most important aspects of a
         | programming language.
        
           | daniellarusso wrote:
           | GWU?
        
             | throwaway894345 wrote:
             | Nope. And I'm not going to say since this is my top secret
             | anon account.
        
       | Bostonian wrote:
       | His discussion of Ada (not all upper case -- can the HN title be
       | changed?) is interesting, but his criticism of Fortran, although
       | colorful ("eldritch"?) , is vague and likely uninformed. I
       | program in Fortran 95 a lot and can easily understand my code
       | years later.
       | 
       | "Admittedly, I had pictured Ada's syntax resembling the
       | uncompromising verbosity and rigid construction of COBOL, or
       | perhaps the Lovecraftian hieroglyphics of Fortran's various
       | eldritch incarnations."
        
         | linuxlizard wrote:
         | I enjoyed Fortran/FORTRAN. Is a nice succinct language.
         | 
         | "Lovecraftian hieroglyphics of Fortran" <-- the author never
         | programmed in Perl, I presume.
        
           | ch_123 wrote:
           | > "Lovecraftian hieroglyphics of Fortran" <-- the author
           | never programmed in Perl, I presume.
           | 
           | Or in Fortran, it's a relatively verbose language from what I
           | remember of it (that said, I learned Fortran 90/95, so maybe
           | the older variants were worse)
        
             | madhadron wrote:
             | More likely the author was faced with numerical code in
             | FORTRAN and confused large formulas with the language
             | syntax being heavy in symbols.
        
           | basementcat wrote:
           | APL puts the _love_ in _Lovecraftian_.
        
           | protomyth wrote:
           | _" Lovecraftian hieroglyphics of Fortran" <-- the author
           | never programmed in Perl, I presume._
           | 
           | The author might want to stay away from MUMPS for sanity's
           | sake.
        
             | cmrdporcupine wrote:
             | My wife used to work as a webdev at a shop that made its
             | bread and butter contracting out some devs to do M/MUMPS
             | development for a bank. Truly horrifying. The language/DB,
             | but also that this thing was involved in handling people's
             | money.
        
             | linuxlizard wrote:
             | I very briefly encountered MUMPS in grad school and its
             | eldritch horror has remained seared in my brain.
        
               | protomyth wrote:
               | In true Cthulhu fashion, after encountering it at a
               | medical facility where the lead programmer bragged about
               | how amazing it was, I bought a book on the language. I
               | like collecting language books (Icon was fun), but that
               | was rather painful to read through and I have done IBM
               | JCL and found it not unpleasant.
        
               | cafard wrote:
               | The NY Times a few summers ago wrote up some firm in
               | Wisconsin that handles data-processing for quite a few
               | insurance companies, using MUMPS. A co-worker's son a
               | summer or so before had weighed competing internships
               | from that firm and from a financial company in New York.
               | I said I thought that the latter would offer more
               | portable experience.
        
           | ska wrote:
           | s/Perl/APL/
        
       | nevster wrote:
       | We did Ada at UNSW in the early 90's but for only one subject -
       | parallel programming. I think many dining philosophers starved
       | during the assignments...
        
       | JulianMorrison wrote:
       | I think the thing that's been under-sold in Ada is the way you
       | can get so much at compile time as properties of things, like,
       | you can say "this type counts between 1 and 30" and then later
       | refer to "the largest value of this type" as a loop bound, say,
       | in a way that won't break if you later set the maximum to 40. And
       | hides the fact it's implemented as an unboxed primitive integer.
        
       ___________________________________________________________________
       (page generated 2021-03-02 23:01 UTC)