Ada (was: D (was: Quo vadis,
J. David Bryan
jdbryan at acm.org
Sat Jul 31 19:32:53 CEST 2010
On Saturday, July 31, 2010 at 6:01, Frank Heckenbach wrote:
> For the 3 big things I mentioned, I know C++ has them already. I don't
> know if Ada does, perhaps you can give us some information here, e.g.,
> is its object model comparable to those GPC supports or that of C++;
I am not familiar with objects in GPC, and only tangentially familiar with
C++ (i.e., have not done any serious programming in it). However, the
short answer is yes; objects are called "tagged types" in Ada.
There is a guide that discusses comparable Ada and C++ features here:
http://www.adahome.com/Ammo/Cplpl2Ada.html
or more nicely formatted here:
http://home.agh.edu.pl/~jpi/download/ada/guide-c2ada.pdf
It has a section devoted to the Ada object model:
http://www.adahome.com/Ammo/Cplpl2Ada.html#3
(Note that this guide discusses Ada 95, which superceded the original Ada
83, and has itself been superceded by Ada 2005. As such, it is a bit out
of date, although language revisions have been kept backward-compatible.
Ada undergoes periodic improvements; the next language revision is
scheduled for 2012.)
> does Ada supported exception handling and how;
Yes; see:
http://www.adahome.com/Ammo/Cplpl2Ada.html#1.2.7
> does it support something like templates (IOW, how can one implement,
> say, a generic list, applicable to any given type, with strong
> type-checking).
Yes; templates are called "generics" in Ada. See:
http://www.adahome.com/Ammo/Cplpl2Ada.html#4
> Packed arrays/records and array slices can be implemented in C++ code
> with moderate effort....
Indeed, any language may be used as the intermediate for GPC. However, I
would expect that the effort required to write a translator would vary,
depending on the closeness of the mapping between GPC and that language.
My impression is that C++ doesn't map particularly well to Pascal's type
structure (subranges, sets, packed structures), and while that may be
overcome with moderate effort, as you say, that effort may be less with a
different choice of intermediate language. Granted, though, that this
mapping is just one of several variables influencing that choice.
> I fear this might only be true for more traditional Pascal, while I
> stated that I'm particularly interested in more "modern" features
> that I know from C++. Of course, if Ada also supports them, it would
> make it more interesting.
"Modern" features, such as templates and exception handling, have been
present in Ada from the beginning (1983). :-)
-- Dave
More information about the Gpc
mailing list