[erlang-questions] Erlang and Ada

Ramon Diaz-Uriarte rdiaz02@REDACTED
Sun Apr 1 18:43:11 CEST 2007

On 3/30/07, ok <ok@REDACTED> wrote:
> On 29 Mar 2007, at 10:00 pm, Ramon Diaz-Uriarte wrote:
> > I was looking for a comparison of Erlang with Ada and could find very
> > little (I searched comp.lang.ada, the erlang list, and lambda the
> > ultimate, and did a variety of goodle searches). I understand that the
> > two languages have different origins and have been mainly applied in
> > different areas (telecom --Erlang-- vs. aviation and military --Ada).
> > But it seems both are unique among "major languages" in the support
> > they provide for concurrent and distributed programming using message
> > passing. Why, then, so few comparisons among the two?
> I have copies of the Ada 81, Ada 83, Ada 95, and Ada 2005 standards.
> I haven't finished reading the last of these, as I only got it recently.
> However, I can certainly assure you that there is nothing in any of the
> previous Ada standards concerning distribution.  Ada was designed to be

Aha, I see. You obviously know this stuff, so I won't argue, but I
thought in Appendix E (for Ada 95) there was some stuff related
to/relevant for distribution. Anyway, you make this clear enough, and
now that I reread some of my Ada material, I can find "concurrent" and
parallel, but nothing that would indicate distributed. So I guess I
managed to confuse myself.

> a clean general-purpose programming language with a special emphasis on
> embedded systems, which is one reason why the Ada standards do not
> require
> garbage collection.  The SPARK Ada subset, that is, the subset supported
> by the SPARK verifier, doesn't even include dynamic allocation, although
> that is certainly part of the full language.
> Nor does Ada use message passing.  It uses the *rendezvous*, which is
> a bit like message passing except that it is synchronous and unbuffered.
> If one Ada task wants another task to do something, it has to wait until
> the other task is ready to receive the request.  The 'select' statement
> of Ada is very similar indeed to Erlang's 'receive', but the one is
> unbuffered synchronous and the other buffered asynchronous.

Thanks for the clarification!

> The different backgrounds lead to another important difference.
> Erlang is designed for systems where you expect to upgrade the software
> while it is running without taking the system down; this is the famous
> "hot loading", and amongst other things it presupposes a network over
> which the changes can be distributed.  Ada was designed for conventional
> applications and for embedded systems, where you are expected to follow
> a development process that gets the program "right the first time".
> There
> is no notion in the Ada language of any kind of dynamic loading.
> (Which is
> not to say that Ada can't use dynamic linking on those operating systems
> that have it, only that it's not part of the standard language or
> libraries
> in the same way that it's not part of the standard C language or
> libraries.)

OK, I see. I never paid too much attention to these issues since
neither make a whole lot of difference for my current projects (or,
I've never programmed in a language that allows "hot loading", so
maybe I have no idea what I've been missing).

> Interestingly, both Ada 95 and Erlang/OTP allow a kind of dotted
> module name,
> and from my point of view they both got the dotted names inside out,
> but Ada
> 95 "child packages" really have some point to them.  (For example an Ada
> package can have *private* children that other packages cannot see.
> Neither
> Java nor Erlang can manage that.  Also, Ada children can be allowed
> to see
> inside their parents, which again neither Java nor its slavish
> imitator in
> this respect, Erlang, allows.)
> Arguably the single most important difference between Ada and Erlang is
> that Ada is an imperative language relying on destructive updates to
> variables and arrays, while Erlang is mostly functional.  One of the

Yes, this part I was aware of. I understand it is a  big difference
but I guess that this ought not to stop anyone from using Erlang or
Ada if either one meets their needs.

> things
> that makes Ada a nice language for concurrency is that it doesn't SHARE
> mutable data between tasks.

But you cannot run into trouble in this issue with Erlang, either.

The nearest it comes is something called a
> 'protected record', which is essentially a 'monitor' (or a Java
> object all
> of whose methods are synchronised and with no exported fields).
> Nevertheless
> it is only really at home on shared *memory* machines.

Aha, that is something I wasn't aware of. And that seems a crucial point.

> Ada doesn't have any form of pattern matching other than a 'case'
> statement

Yep. Erlang's pattern matching is a very neat feature.

> which is similar to (but MUCH cleaner and far easier to get right) the
> C/C++/Java 'switch' statement.  It _could_ have something fancier;
> Mesa did.

Thanks again for your detailed answers.



> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions

Ramon Diaz-Uriarte
Statistical Computing Team
Structural Biology and Biocomputing Programme
Spanish National Cancer Centre (CNIO)

More information about the erlang-questions mailing list