1. 20
  1.  

  2. 3

    I used the cargo-like Alire instead of gnatmake, but I found Ada to be an enjoyable language to toy around in when I learned it earlier this year.

    1. 2

      I am somewhat interested in Ada, but there is absolutely no way that I’d take a dependency on a language where the only F/OSS implementation is GPLv3. It’s a shame that AdaLabs’ effort to write an LLVM front end for Ada didn’t work out.

      1. 2

        LLVM compiler is still work in progress. Also few more compilers coming up. Foss GPLv3 is now with exception license also

    2. 3

      Ada seems like an interesting language, but I wish this article was written better. A number of concepts, like attributes, are used without being explained, and there are number of confusing typos.

      All that aside, I’m curious as to what would be the benefits of using Ada over something like OCaml which also has a good type system, modularity and these days a decent ecosystem with modern tooling.

      1. 3

        I wish this article was written better

        I have my own writeup about Ada if you’re interested.

        number of confusing typos

        with ada.Text_IO; use Ada.Text_IO;
        

        Completely legal, but still a typo. Ada isn’t case sensitive, but normally you’d see Ada.Text_IO. I thought case insensitivity would be a huge deal breaker, but I never had issues with it in practice.

        -- while loop
           while myCount < 3 loop
        

        -- is a comment, not sure why they thought they needed a comment here.

        like attributes, are used without being explained

        It’s a built-in function or property associated with a type: 'Alignment for byte alignment, 'Length for array length, 'Succ for the next successive enum, 'Image for toString() like behavior, etc. Some can be overridden. It looks like the code formatter doesn’t support for notation, so it erroneously highlights the following code in the article.

        using Ada over something like OCaml

        Ada cross-platform support with Free Software Foundation’s GNAT (in gcc) is good. I have multiple programs which run on Windows and Linux, which include things like iterating over files/directories and concurrency (built into Ada) without changes.

        Ada supports package generics which are like OCaml’s signatures. I had to use the OCaml documentation to clarify what a signature was when I was learning it at the time. Being able to define ranges and your own type invariants is super helpful for modeling a problem, and built-in pre/post conditions help catch a few edge cases I missed.

        decent ecosystem with modern tooling

        It’s much better than I ever expected Ada to have. Alire is sort of like cargo except it also installs toolchains for you as well. There’s a language server and a Visual Studio Code integration which uses it. The tooling folks have been super responsive, I’ve gotten bugs and feature requests fixed in a day or so before.

        1. 2

          Thank you! This was very useful. I will check out your article.

          1. 1

            That similarity isn’t accidental: both module systems are descendants of Wirth’s Modula-2 module system.

            I prefer OCaml for most use cases myself, but I don’t think there’s anything better than Ada right now for embedded applications, especially if they are safety-critical. Range types, type-safe approach to pointers, etc.—it’s high-level and expressive but also close to the machine, and suitable for hard realtime.