Coders love comparing programming languages. One comparison that isn't being made very often is Lisp vs. Ada, and for a very good reason.

These languages are as distinct as one can imagine, and were designed for completely different purposes. While Lisp was designed to be highly flexible and dynamic in order to solve difficult problems with unclear requirements, Ada was built to construct large, well defined programs with very clear interfaces. Ada features one of the strictest typing static systems one can find in the taxa of programming languages. On the other hand, Lisp is the most flexible language around - even its syntax can be extended and source code can be manipulated in the form of a syntax tree.

Curiously, in the past couple of months I'm working extensively with both. Followers of this blog have surely noticed that I'm spending a lot of time with Lisp lately (both Common Lisp and Scheme). In fact, 100% of my free hacking time is spent mastering this language. On the other hand, at work I mostly code in Ada now, as my current project is writing a set of device drivers for the Freescale MPC55xx embedded controller in Ada.

What can I say... with Lisp constantly in the subconscience writing Ada is hard. Even C programmers become quickly irritated by the strictness of the compiler and the harsh rules the language standard imposes. So for a Lisper the dismay is double.

However, I must admit that Ada is actually not that bad for its purpose. No one should ever consider writing experimental, highly dynamic code in Ada. But for embedded application, it is quite suitable. The language is very rigidly defined, and its LRM (Language Reference Manual) defines any small point and doubt and is freely available. The compilers must be fully conforming - there's no mess like in the C++ world. Any error message shown by the compiler (we use the Green Hills AdaMulti compiler, but I suspect others are similar) is followed by a reference to the relevant section of the LRM. And all this type strictness also has its merits, especially when interfaces in the code have to be very rigidly defined. Some say that in Ada, once you get past the compiler, the program is correct, in most likeness. While this is of course nonsense, it does indicate a trend. Indeed, the language standard is so strict (especially in the matter of static typing) that the compiler catches a considerable amount of blunders. And what's not caught by the compiler is caught by run-time exceptions (that can be turned off once the code is fully tested and performance matters). Ada supports large programs with a convenient package system, object oriented programming, generic functions, tasks and synchronization methods built into the language. It is also very tailored to embedded code - the standard defines how to handle interrupts, access hardware and implement low-level tasking details.

And yet, how do I yearn for Lisp's flexibility from time to time when I'm writing tons of repetitive Ada code which I have absolutely no way to avoid (bar generating Ada code from some Lisp/Perl program).