3 ms·
I'm using Ada for time-critical code in my hobby projects. In my opinion, there are four major catches: * Long learning curve: The syntax is unusual in that it
by jonathanstrange 10y ago
I'm using Ada for time-critical code in my hobby projects. In my opinion, there are four major catches:
* Long learning curve: The syntax is unusual in that it is specifically defined for every construct of the language. That makes the learning curve long, because you need to grasp the possibilities for every syntactic construct separately and there is some multiple uses of keywords like "with". Generally, conceptual simplicity is not a strength of Ada.
* String handling: In an attempt to please everyone, Ada provides fixed-length strings, bounded-length strings, unlimited length strings with byte-sized chars, wide chars, and wide wide chars and you have to convert between these representations all the time. Nevertheless, it only supports UCS encoding, not UTF, in the core language. So to e.g. use UTF8 strings, you either have to abuse ordinary byte-size char strings, which is a type error, or use an external package plus all the conversions to and from the internal format. It's a constant pain in the ass and source of non-portability, and they should have included full support for UTF8 and/or UTF32 in the recent standard.
* Too strict aliasing rules: Apparently to keep the static compiler checks simple, Ada's rules for pointers (aka aliases) are sometimes too strict, i.e., you may sometimes not be able to use pointers to procedures and heap-allocated objects even when it is provable that they cannot dangle. This can create major problems or force you to do unsafe conversions or overlays, if you don't design your application carefully. Arguably, there are only rare cases in which you should use pointers and you generally don't need them very often in Ada. But it can be a tumbling stone for people coming from C or C++.
* Licensing & vendor lock-in: If you install AdaCore's version, your programs become GPL! If you don't like that, you need to install FSF's version, which does not come with some essential libraries from AdaCore that are also GPL. However, evern FSF's version is only mGPL, not LGPL, meaning it is GPL with a runtime exception. Generally speaking, license confusions have kept many people from using Ada. Moreover, the only really modern compiler comes from AdaCore (who contribute GNAT to gcc), other compilers only support Ada95 and are prohibitively expensive anyway. So there is also a certain vendor lock-in, and e.g. fear that AdaCore might stop contributing to the mGPL version. That's a big issue for anyone who would like to use Ada for business without buying expensive licenses from AdaCore.
Basically, AdaCore is a dubious player, not a role model of a successful open source software company, as it is sometimes portrayed.
Other than the above, Ada is a fantastic language. Once your code compiles, it nearly always works, and you will be able to understand it years later even if it is undocumented. Ada really is self-documenting and fast, that's why I use it.
Edit: Forgot one thing. It's also a disadvantage that no current Ada implementation has a GC (although a GC is compatible with the standard). Since it has become trendy to bash GCs and advocate manual memory management for mostly unsound reasons anyway, the point didn't make it in the list above.
- Keyframe 10y agoHowever, evern FSF's version is only mGPL, not LGPL, meaning it is GPL with a runtime exception. Hmm, how does that demonstrate itself in practice? It shouldn't matter for your app, right? With FSF version you can(?) compile and distribute your stuff. Like with 'normal' gcc/glibc. How about static? Licenses usually throw me off since they get so confusing. It seems like it's a story similar to Lisp and Franz/Allegro CL. Lisp got better with SBCL supporting Windows later on.
- acomjean 10y agoI agree that Ada's string handling was terrible. More than terrible in fact. >If you install AdaCore's version, your programs become GPL! You sure about that? I worked at a company moving from Old Unix to Linux and were going to move to AdaCore compliers. This was a company that wanted to make sure when we downloaded software it went through a legal dept to check the licencing, and having the companies code released GPL would have been a non-starter. This was 10+ years ago though..
- JohnStrange 10y agoYour company probably paid for the commercial license ("GNAT Pro"). It's very expensive.
- acomjean 10y agoThey were contemplating purchasing a license I know. I left before anything happened. Keep in mind they were paying a fortune for support for another ada compiler (Rational APEX) on obsolete hardware (Solaris/ HPUX). I suspect they were evaluating if it was cheaper than migrating a huge codebase to another language. Migrating platforms can be a pain in the endian.