Eiffel and Ada

57 views
Skip to first unread message

John Perry

unread,
Mar 10, 2019, 8:42:45 PM3/10/19
to Eiffel Users
Hello

Dr. Meyer wrote in another thread:

All Eiffel-related comments, whether from newbies or from experts, whether conventional or outlandish, are welcome.

That prompts me to inquire about something I've been wondering for some months now.

I like Eiffel and have used it in the past, mainly the distant past. I also like Ada and have used it, though much less.

I used to think Eiffel's *main* difference (and advantage) over other programming languages was contracts, but I see that Ada 2012 has contracts, and if one restricts one's work to SPARK 2014, the toolset can use contracts to prove correctness of programs written in a subset of Ada. Nice! It also suggests that those responsible for Ada's evolution look seriously at other languages & admired something about Eiffel enough to adapt it to Ada.

Now that Ada has contracts, then, I would be interested in what people think sets Eiffel apart from Ada, or vice-versa. I'm interested not only in Eiffel's advantages, but also things Eiffel programmers might admire about Ada, even if they don't really want it in Eiffel.

I can answer this to some extent already:
  • Eiffel is a pure object-oriented language; everything has to be a class. Ada organizes software into packages and offers object-oriented capabilities but not nearly so robustly as Eiffel. I have the impression from what I've read that multiple inheritance in Ada is challenging, but I haven't tried it in Ada so I don't really know.
  • Eiffel employs garbage collection. Ada uses memory pools, but garbage collection is optional.
  • Eiffel offers a very, very simple concurrency interface ("separate" keyword) whereas Ada's tasking model is possibly one reason people won't use it (though I remember that I came to like it a lot once I wrapped my head around it).
  • Both are interested in, and oriented towards, producing correct programs at compile time. Ada has tools that do this for a subset of the language (e.g., SPARK).
  • Ada was designed with real-time computing in mind. I'm not aware if Eiffel is used anywhere for real-time.
  • Eiffel ensures pointer safety via Void safety, whereas Ada prefers to discourage the user from avoid pointers at all.
I'm more interested in differences beyond these -- or any corrections of mistakes or misunderstandings here! -- but there can be aspects of these that matter a great deal to someone, especially in the details, in which case feel free to delve into details.

If that is way too far from the purpose of this group, I'd be just as grateful (and might even prefer it) if someone can email me or direct me to a website, journal article, or book that considers this issue. I'm not interested in a flamewar, just very curious. I like both languages a great deal, though I haven't done nearly enough with them to pretend to be an expert.

sincerely
john Perry

PS I'm not a computer scientists by trade, so I apologize if I've mischaracterized anything through sloppy language or abuse of vocabulary.

John Perry

unread,
Mar 10, 2019, 8:47:33 PM3/10/19
to Eiffel Users
Well, here's one place my own sloppiness of language may count as a mischaracterization:

  • Eiffel employs garbage collection. Ada uses memory pools, but garbage collection is optional.
I understand that GC is actually optional in Eiffel, or at least, one can turn it off in EiffelStudio. What I meant is that GC is the default.

As for Ada, GC is a possibility by design, but I understand that it's left to the implementation to decide. This is one obvious place where I'm not so clear on the details, and wouldn't mind more explanation.

john perry

Larry Rix

unread,
Mar 11, 2019, 9:53:58 AM3/11/19
to Eiffel Users
Hi John,

I know the GC can be suspended, but am not aware of being able to disable it utterly (either in ES or from the ECF). I am not sure why one would want to operate without a GC and what the alternative would look like.


Larry

Eric Bezault

unread,
Mar 11, 2019, 10:14:33 AM3/11/19
to eiffel...@googlegroups.com, Larry Rix
FYI, the Gobo Eiffel compiler can run with no GC.
It's because it has been implemented so that it does not generate
any garbage (or almost any).
The advantage of compiling this application this way is that it makes
it run faster.
But the only programs that I can think of which could benefit from
that, are, like the Gobo compiler, non-GUI non-interactive programs
which produce little garbage and need to run fast.

--
Eric Bezault
mailto:er...@gobosoft.com
http://www.gobosoft.com

Finnian Reilly

unread,
Mar 11, 2019, 10:14:37 AM3/11/19
to Eiffel Users
Ada uses memory pools

  • Eiffel employs garbage collection. Ada uses memory pools, but garbage collection is optional.
Ada's memory pool concept is quite easy to implement in Eiffel by using once instances. Eiffel-Loop makes use of memory pools to recycle string instances. See for example class EL_STRING_8_CONSTANTS and class EL_STRING_POOL.

In theory you could write a program in Eiffel that disabled GC and managed everything with memory pools.
Reply all
Reply to author
Forward
0 new messages