comp.lang.ada
 help / color / mirror / Atom feed
* Ada Generic vs. C++ Templates
@ 2001-04-02 14:28 Josef Widder
  2001-04-02 14:38 ` Ted Dennison
                   ` (3 more replies)
  0 siblings, 4 replies; 33+ messages in thread
From: Josef Widder @ 2001-04-02 14:28 UTC (permalink / raw)


As project for university i'd like to compare the power of the Ada 
Generic construct relative to C++ templates.

Could someone please tell me where to find good articles on the generic 
construct ?

greetings
  Josef



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 14:28 Ada Generic vs. C++ Templates Josef Widder
@ 2001-04-02 14:38 ` Ted Dennison
  2001-04-02 20:57   ` Francois Godme
  2001-04-04 13:24 ` Georg Bauhaus
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 33+ messages in thread
From: Ted Dennison @ 2001-04-02 14:38 UTC (permalink / raw)


In article <MPG.1532ab1cc6ed7b4989682@news.chello.at>, Josef Widder says...
>
>As project for university i'd like to compare the power of the Ada 
>Generic construct relative to C++ templates.
>
>Could someone please tell me where to find good articles on the generic 
>construct ?

One thing you should be sure to mention is portability. All Ada compilers must
adhere to (and are tested against) the same standard. In contrast, C++ compilers
all seem to implement templates differently. The Mozilla developers have gone so
far as to ban the use of templates for this reason (in fact, its rule #1 in
their portability guide). See
http://www.mozilla.org/hacking/portable-cpp.html#dont_use_templates . One could
say that for code meant to be portable, C++ templates have no power at all, as
they can't be used. :-)

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 14:38 ` Ted Dennison
@ 2001-04-02 20:57   ` Francois Godme
  2001-04-02 21:26     ` Ted Dennison
  0 siblings, 1 reply; 33+ messages in thread
From: Francois Godme @ 2001-04-02 20:57 UTC (permalink / raw)


Ted Dennison a �crit :

> One thing you should be sure to mention is portability. All Ada compilers must
> adhere to (and are tested against) the same standard. In contrast, C++ compilers
> all seem to implement templates differently. The Mozilla developers have gone so
> far as to ban the use of templates for this reason (in fact, its rule #1 in
> their portability guide). See
> http://www.mozilla.org/hacking/portable-cpp.html#dont_use_templates . One could
> say that for code meant to be portable, C++ templates have no power at all, as
> they can't be used. :-)

For Ada supporters, it may be reassuring to rest on those somewhat outdated
statements but templates are working by now because they are central to the
implementation of the C++ Standard Templates Library (STL for short).

In my daily work, we develop C++ templates code which compiles and runs the same on
two different platforms namely Visual C++ 6.0 on NT and aCC on HP-UX. I am not
saying that all the implementations are perfect but that they are mature enough to
be of a practical use in a commercial environment.





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 20:57   ` Francois Godme
@ 2001-04-02 21:26     ` Ted Dennison
  2001-04-03  0:53       ` David Starner
  2001-04-03 22:09       ` Francois Godme
  0 siblings, 2 replies; 33+ messages in thread
From: Ted Dennison @ 2001-04-02 21:26 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1792 bytes --]

In article <3AC8E799.189EE51C@bigfoot.com>, Francois Godme says...
>
>Ted Dennison a �crit :
>
>> all seem to implement templates differently. The Mozilla developers have 
>> gone so far as to ban the use of templates for this reason (in fact, its 
>> rule #1 in their portability guide). See
>> http://www.mozilla.org/hacking/portable-cpp.html#dont_use_templates . One 
>> could say that for code meant to be portable, C++ templates have no power at 
>> all, as they can't be used. :-)
>
>In my daily work, we develop C++ templates code which compiles and runs the 
>same on two different platforms namely Visual C++ 6.0 on NT and aCC on HP-UX. 

What you are saying is that you have found an environment where the templates
you happen to use work for two specific compilers. That says nothing about what
would happen if one day you (or your marketing department) suddenly discovered a
need to port your entire codebase to a third system which you have not designed
your code against. Unless the Mozilla developers are lying (which I doubt), it
appears that it is quite possible that you'll run aground on a compiler that
does not support your templates.

>I am not saying that all the implementations are perfect but that they are 
>mature enough to be of a practical use in a commercial environment.

I didn't say they weren't of practical use. I just said they are not a feature
that can be counted on to be portable; at least not according to Mozilla. Their
website was quite recently updated, and still includes the template prohibition
as rule #1. Since they run the most ported public application that I know of,
I'm inclined to bow to their experience.

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 21:26     ` Ted Dennison
@ 2001-04-03  0:53       ` David Starner
  2001-04-04  7:12         ` Pascal Obry
                           ` (2 more replies)
  2001-04-03 22:09       ` Francois Godme
  1 sibling, 3 replies; 33+ messages in thread
From: David Starner @ 2001-04-03  0:53 UTC (permalink / raw)


On Mon, 02 Apr 2001 21:26:12 GMT, Ted Dennison <dennison@telepath.com> wrote:
>I didn't say they weren't of practical use. I just said they are not a feature
>that can be counted on to be portable; at least not according to Mozilla. Their
>website was quite recently updated, and still includes the template prohibition
>as rule #1. Since they run the most ported public application that I know of,
>I'm inclined to bow to their experience.

Maybe the most ported public C++ application; I think gcc, which runs on
VMS, DOS, Windows, Unix, BeOS and MacOS X, among others, beats Mozilla, as 
do a number of the other GNU tools.

-- 
David Starner - dstarner98@aasaa.ofe.org
Pointless website: http://dvdeug.dhis.org
"I don't care if Bill personally has my name and reads my email and 
laughs at me. In fact, I'd be rather honored." - Joseph_Greg



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 21:26     ` Ted Dennison
  2001-04-03  0:53       ` David Starner
@ 2001-04-03 22:09       ` Francois Godme
  2001-04-04 16:17         ` Brian Rogoff
                           ` (2 more replies)
  1 sibling, 3 replies; 33+ messages in thread
From: Francois Godme @ 2001-04-03 22:09 UTC (permalink / raw)


I still don't think we can all rest on our laurels.

The C++ STL is, by far, a piece of code larger than all the Ada generic units
combined you can find in the Ada95 standard. GCC compiles the STL, so do Visual C++
and aCC. Isn't it enough signs of evidence?

Even more, now that the language has been written down as a standard, what can stop
the convergence of the C++ compilers to the standard?





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03  0:53       ` David Starner
@ 2001-04-04  7:12         ` Pascal Obry
  2001-04-04 12:37         ` Stephen Leake
  2001-04-04 14:16         ` Ted Dennison
  2 siblings, 0 replies; 33+ messages in thread
From: Pascal Obry @ 2001-04-04  7:12 UTC (permalink / raw)



dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner) writes:

> Maybe the most ported public C++ application; I think gcc, which runs on

No GCC is plain C not C++.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|         http://perso.wanadoo.fr/pascal.obry
--|
--| "The best way to travel is by means of imagination"



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03  0:53       ` David Starner
  2001-04-04  7:12         ` Pascal Obry
@ 2001-04-04 12:37         ` Stephen Leake
  2001-04-04 14:16         ` Ted Dennison
  2 siblings, 0 replies; 33+ messages in thread
From: Stephen Leake @ 2001-04-04 12:37 UTC (permalink / raw)


dvdeug@x8b4e53cd.dhcp.okstate.edu (David Starner) writes:

> On Mon, 02 Apr 2001 21:26:12 GMT, Ted Dennison <dennison@telepath.com> wrote:
> >I didn't say they weren't of practical use. I just said they are not a feature
> >that can be counted on to be portable; at least not according to Mozilla. Their
> >website was quite recently updated, and still includes the template prohibition
> >as rule #1. Since they run the most ported public application that I know of,
> >I'm inclined to bow to their experience.
> 
> Maybe the most ported public C++ application; I think gcc, which runs on
> VMS, DOS, Windows, Unix, BeOS and MacOS X, among others, beats Mozilla, as 
> do a number of the other GNU tools.

"gcc" is the Gnu Compiler Collection. It consists of a backend,
written in K&R C. The C front end is also written in K&R C. The Ada
front end is written in Ada (this is an Ada newsgroup, after all :). I
haven't looked at the C++ front end; are you implying it is written in
C++? And does it compile on anything other than Gnu C++? and does it
use templates?

Ted's point is that templates are not portable among compilers. Your
response does not seem to address that issue.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 14:28 Ada Generic vs. C++ Templates Josef Widder
  2001-04-02 14:38 ` Ted Dennison
@ 2001-04-04 13:24 ` Georg Bauhaus
  2001-04-05  8:46   ` Jean-Marc Bourguet
  2001-04-04 17:30 ` Ehud Lamm
  2001-04-08  5:00 ` Lao Xiao Hai
  3 siblings, 1 reply; 33+ messages in thread
From: Georg Bauhaus @ 2001-04-04 13:24 UTC (permalink / raw)


Josef Widder (e9625114@student.tuwien.ac.at) wrote:
: As project for university i'd like to compare the power of the Ada 
: Generic construct relative to C++ templates.

(Sorry if this comes twice, I'm sitting at a US keyboard,
with y in place of z and consequenes...)

Is Josef's question of no general interest? As yet I've
seen only barking preference-statements about 3-character-name
programming languages :-)
Bjarne Stroustrup's Book, 3rd ed., says where C++ templates
originally came from, namely a now outdated version of Ada
and CLU. In anothere thread you, Josef, will find a partial
comparison of C++ templates vs. Ada generics. (Being recursive
or not, compile time issues, ... and relative merits thereof).

As for programming language resources, I find BURKS
rather useful: http://burks.bton.ac.uk/burks/language/index.htm

Iirc, there is a "standard" reference for generics dating
from the late 70s. Could someone in the know enlighten,
please?

Georg



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03  0:53       ` David Starner
  2001-04-04  7:12         ` Pascal Obry
  2001-04-04 12:37         ` Stephen Leake
@ 2001-04-04 14:16         ` Ted Dennison
  2 siblings, 0 replies; 33+ messages in thread
From: Ted Dennison @ 2001-04-04 14:16 UTC (permalink / raw)


In article <9ab6uj$8201@news.cis.okstate.edu>, David Starner says...
>
>On Mon, 02 Apr 2001 21:26:12 GMT, Ted Dennison <dennison@telepath.com> wrote:
(talking of Mozilla)
>>as rule #1. Since they run the most ported public application that I know of,
>>I'm inclined to bow to their experience.
>Maybe the most ported public C++ application; I think gcc, which runs on
>VMS, DOS, Windows, Unix, BeOS and MacOS X, among others, beats Mozilla, as 
>do a number of the other GNU tools.

Right. I should have added "C++" in that sentence. In fact, to be perfectly
accurate, I probably should have also added "large" and/or "complex" (a small
C++ app ported everywhere might happen to not run into problems). But since this
whole issue is over C++ templates, and Mozilla's authority to say whether or not
they are portable in general, all that could (or at least should) be taken as an
implied. 

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03 22:09       ` Francois Godme
@ 2001-04-04 16:17         ` Brian Rogoff
  2001-04-04 16:21         ` Jeffrey Carter
  2001-04-05  0:35         ` James Rogers
  2 siblings, 0 replies; 33+ messages in thread
From: Brian Rogoff @ 2001-04-04 16:17 UTC (permalink / raw)


On Tue, 3 Apr 2001, Francois Godme wrote:
> I still don't think we can all rest on our laurels.
> 
> The C++ STL is, by far, a piece of code larger than all the Ada generic units
> combined you can find in the Ada95 standard. GCC compiles the STL, so
> do Visual C++ and aCC. Isn't it enough signs of evidence?
> 
> Even more, now that the language has been written down as a standard,
> what can stop the convergence of the C++ compilers to the standard?

Good points.You could also mention that it was some time before Ada
generics were robust too. Stepanov mentions in some of his early STL
papers that lots of Ada compilers couldn't handle his code. 

Contrary to what someone else wrote, C++ templates do give you extra
expressive power over Ada in some areas. Examples? Sure

http://www.eecs.harvard.edu/~nr/pubs/error-abstract.html

Would I want to write that in C++? No, I much prefer (OCa)ML, but the
point is that automatic instantiation of template gives you a crude form 
of parametric polymorphism, whereas Ada generics are *not* parametric 
polymorphism, papers by Barbey et al notwithstanding. 

Is the converse true too? Sure Ada generics provide type constraints, 
can take subprogram arguments (and simulate *some* cases of downward
funargs), can be packages and take package arguments, etc. 

As I've said many times, automatic instantiation would be very nice, and 
would tip the scales totally to Ada IMO. But it isn't going to happen. 
If that bothers you too much, don't use Ada. 

Anyways, the responses to the question have been depressing, with lots of
finger pointing at some old Mozilla site. If I were the original poster
I'd have guessed by now that Ada programmers are very defensive, and
dumber than mud, since they can't answer simple questions. :-)

-- Brian





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03 22:09       ` Francois Godme
  2001-04-04 16:17         ` Brian Rogoff
@ 2001-04-04 16:21         ` Jeffrey Carter
  2001-04-04 16:49           ` Ayende Rahien
  2001-04-04 16:56           ` Ted Dennison
  2001-04-05  0:35         ` James Rogers
  2 siblings, 2 replies; 33+ messages in thread
From: Jeffrey Carter @ 2001-04-04 16:21 UTC (permalink / raw)


Francois Godme wrote:
> 
> Even more, now that the language has been written down as a standard, what can stop
> the convergence of the C++ compilers to the standard?

The desire of C++ compiler vendors to tie users to their compilers.

Where is P. Brashear when we need him? IIRC, he is involved in Ada
compiler conformance testing, and also has a C++ conformance suite. No
C++ compiler vendor has ever submitted a compiler for testing, nor has
any C++ compiler ever passed.

Jeffrey Carter



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 16:21         ` Jeffrey Carter
@ 2001-04-04 16:49           ` Ayende Rahien
  2001-04-05 22:31             ` Colin Paul Gloster
  2001-04-04 16:56           ` Ted Dennison
  1 sibling, 1 reply; 33+ messages in thread
From: Ayende Rahien @ 2001-04-04 16:49 UTC (permalink / raw)



"Jeffrey Carter" <jeffrey.carter@boeing.com> wrote in message
news:3ACB4A1B.1AC1ACF7@boeing.com...
> Francois Godme wrote:
> >
> > Even more, now that the language has been written down as a standard,
what can stop
> > the convergence of the C++ compilers to the standard?
>
> The desire of C++ compiler vendors to tie users to their compilers.

This is self evident by the fact that you can't pass ".h" files around C++
compilers (usually).






^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 16:21         ` Jeffrey Carter
  2001-04-04 16:49           ` Ayende Rahien
@ 2001-04-04 16:56           ` Ted Dennison
  2001-04-04 17:02             ` Ayende Rahien
  1 sibling, 1 reply; 33+ messages in thread
From: Ted Dennison @ 2001-04-04 16:56 UTC (permalink / raw)


In article <3ACB4A1B.1AC1ACF7@boeing.com>, Jeffrey Carter says...
>
>Francois Godme wrote:
>> 
>> Even more, now that the language has been written down as a standard, what 
>> can stop the convergence of the C++ compilers to the standard?

>Where is P. Brashear when we need him? IIRC, he is involved in Ada
>compiler conformance testing, and also has a C++ conformance suite. No
>C++ compiler vendor has ever submitted a compiler for testing, nor has
>any C++ compiler ever passed.

I'd at least think it would be worth Microsoft's while to submit their compiler,
so they could find and remove any portabilities. :-)

Nah, easier to just write your own new langage...

---
T.E.D.    homepage   - http://www.telepath.com/dennison/Ted/TED.html
          home email - mailto:dennison@telepath.com



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 16:56           ` Ted Dennison
@ 2001-04-04 17:02             ` Ayende Rahien
  0 siblings, 0 replies; 33+ messages in thread
From: Ayende Rahien @ 2001-04-04 17:02 UTC (permalink / raw)



"Ted Dennison" <dennison@telepath.com> wrote in message
news:MmIy6.1648$jz.139450@www.newsranger.com...
> In article <3ACB4A1B.1AC1ACF7@boeing.com>, Jeffrey Carter says...
> >
> >Francois Godme wrote:
> >>
> >> Even more, now that the language has been written down as a standard,
what
> >> can stop the convergence of the C++ compilers to the standard?
>
> >Where is P. Brashear when we need him? IIRC, he is involved in Ada
> >compiler conformance testing, and also has a C++ conformance suite. No
> >C++ compiler vendor has ever submitted a compiler for testing, nor has
> >any C++ compiler ever passed.
>
> I'd at least think it would be worth Microsoft's while to submit their
compiler,
> so they could find and remove any portabilities. :-)
>
> Nah, easier to just write your own new langage...

They did, they call it C# :)






^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 14:28 Ada Generic vs. C++ Templates Josef Widder
  2001-04-02 14:38 ` Ted Dennison
  2001-04-04 13:24 ` Georg Bauhaus
@ 2001-04-04 17:30 ` Ehud Lamm
  2001-04-05 22:04   ` Colin Paul Gloster
  2001-04-08  5:00 ` Lao Xiao Hai
  3 siblings, 1 reply; 33+ messages in thread
From: Ehud Lamm @ 2001-04-04 17:30 UTC (permalink / raw)



Josef Widder <e9625114@student.tuwien.ac.at> wrote in message
news:MPG.1532ab1cc6ed7b4989682@news.chello.at...
> As project for university i'd like to compare the power of the Ada
> Generic construct relative to C++ templates.
>
> Could someone please tell me where to find good articles on the generic
> construct ?
>


In fact this is a pretty large subject. I'd restrict it to something more
managable (like "automatic instantiation vs. explicit instantiation" or the
way generic paramaters are specified etc.).

Some useful (I think) references are:
* the Ada83 Rationale chapter on generics
* Alexander Stepanov writings and intervies (some are available on the net,
and I gave URLs in this newsgroup a couple of times). He discusses some this
he considers shortcomings in Ada, as opposed to C++, as related to creating
the STL.
* You may want to check specific uses. The are several examples of C++
temlate libraries that are hard if not impossible to mimic in Ada. Esp.
attempts at providing high-order programming facilties. (I don't have a URL
handy, but a search at http://lambda.weblogs.com should get you started. You
may also raise your question at that site).
* Another thing that may be interesting is to check specific programming
styles. For example Ada's formal package paramters are a bit like using
classes to specify generic parameters, but they induce a different
programming style.

Any way, as I said, this is really a big subject. I suggest you check some
of these and focus your research on something a bit more specific. (Or more
general, like paramateric polymorphism in general).

I'd be glad to help. Email me or use the above mentioned site. (Or here, of
course).

Good luck,

Ehud Lamm





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-03 22:09       ` Francois Godme
  2001-04-04 16:17         ` Brian Rogoff
  2001-04-04 16:21         ` Jeffrey Carter
@ 2001-04-05  0:35         ` James Rogers
  2001-04-05  3:38           ` DuckE
  2 siblings, 1 reply; 33+ messages in thread
From: James Rogers @ 2001-04-05  0:35 UTC (permalink / raw)


Francois Godme wrote:
> 
> Even more, now that the language has been written down as a standard, what can stop
> the convergence of the C++ compilers to the standard?

A related question coming to my mind is "What has kept the convergence 
of the C++ compilers to the standard up to this date?"

As I recall, the GNAT compiler was certified as a correct and standard
implementation of Ada95 within months of the standardization of Ada95.

It has now been nearly four years since the standardization of C++.
As of now, no compiler has been able to prove it properly implements 
the entire C++ standard. 

This lack of success cannot be simply attributed to compiler vendors' 
yearning for independence. I beleive the cause is the difficulties
posed by the C++ standard itself.

I am growing more pessimistic that compliant C++ a compiler will ever 
be produced.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05  0:35         ` James Rogers
@ 2001-04-05  3:38           ` DuckE
  2001-04-05 14:25             ` Marin David Condic
  2001-04-06  0:37             ` James Rogers
  0 siblings, 2 replies; 33+ messages in thread
From: DuckE @ 2001-04-05  3:38 UTC (permalink / raw)



"James Rogers" <jimmaureenrogers@worldnet.att.net> wrote in message
news:3ACBBE65.D65BB767@worldnet.att.net...
> Francois Godme wrote:
> >
> > Even more, now that the language has been written down as a standard,
what can stop
> > the convergence of the C++ compilers to the standard?
>
> A related question coming to my mind is "What has kept the convergence
> of the C++ compilers to the standard up to this date?"
>
> As I recall, the GNAT compiler was certified as a correct and standard
> implementation of Ada95 within months of the standardization of Ada95.
>
> It has now been nearly four years since the standardization of C++.
> As of now, no compiler has been able to prove it properly implements
> the entire C++ standard.

You have implied that GNAT implements the entire Ada95 standard.

While all of the "required" elements are supported, some things are not.

Just try making use of "Ada.Asynchronous_Task_Control" and you'll get a
message:
  Asynchonnous_Task_Control is not implemented.

I believe GNAT was the first (and may still be the only, I'm not sure) to be
"validated" for Ada95 including all annexes.  This does not mean the
compiler is without bugs, nor does it mean that all features described by
the Ada95 standard are implemented.  It merely means that the validation
test suite was passed.

Don't get me wrong, I think validation is a good thing.  But you must be
careful about what it really means.

BTW: I don't really care whether the compiler I use is validated, but it is
reassuring.

SteveD

>
> This lack of success cannot be simply attributed to compiler vendors'
> yearning for independence. I beleive the cause is the difficulties
> posed by the C++ standard itself.
>
> I am growing more pessimistic that compliant C++ a compiler will ever
> be produced.
>
> Jim Rogers
> Colorado Springs, Colorado USA





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 13:24 ` Georg Bauhaus
@ 2001-04-05  8:46   ` Jean-Marc Bourguet
  0 siblings, 0 replies; 33+ messages in thread
From: Jean-Marc Bourguet @ 2001-04-05  8:46 UTC (permalink / raw)


Georg Bauhaus wrote:
> 
> Josef Widder (e9625114@student.tuwien.ac.at) wrote:
> : As project for university i'd like to compare the power of the Ada
> : Generic construct relative to C++ templates.

I see only two differences related to the expressive power of these
constructs:

* In C++ template may be specialized; this allow choices to be made at
compile time according to the arguments and recursive templates and that
brings the template construct to a complete language evaluated at
compile time.

* In Ada, a generic package may be instanciated with the same arguments
several times.

Yours,

-- Jean-Marc



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05  3:38           ` DuckE
@ 2001-04-05 14:25             ` Marin David Condic
  2001-04-05 20:32               ` Robert A Duff
  2001-04-06  0:37             ` James Rogers
  1 sibling, 1 reply; 33+ messages in thread
From: Marin David Condic @ 2001-04-05 14:25 UTC (permalink / raw)


Well, I think it is true that *technically* speaking, an Ada compiler could
read any Ada program and generate code that produced the exception
Program_Error (or some other appropriate exception).(1) All you have to do
is posit that the target implementation is too small to contain *any* legal
Ada program of *any* size. This would be perfectly legal and presumably
ought to pass the validation suite. (This is why I have argued in the past
against the "perfectly legal" defense when a compiler doesn't do what I want
it to do. Its "Perfectly Legal" and "Totally Useless" :-)

I agree that it is less important to me to have a validated compiler than it
is to have one that produces correct, efficient and usable results. It does
give one a warm fuzzy feeling though if the compiler *is* validated because,
if nothing else, it implies that the validation suite has been used as a
test case and the bulk of it must have worked. Its significantly more than a
smoke test of the software. Also, it makes you feel comfortable that you can
use any of the language constructs and (with the possible exception of some
corner cases) get the compiler to recognize what you're trying to do &
hopefully do it.

(1) Hey! Anybody want to gang up and implement the worlds smallest/fastest
Ada compiler & get it validated? :-)

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"DuckE" <nospam_steved94@home.com> wrote in message
news:WMRy6.676244$U46.20968423@news1.sttls1.wa.home.com...
> I believe GNAT was the first (and may still be the only, I'm not sure) to
be
> "validated" for Ada95 including all annexes.  This does not mean the
> compiler is without bugs, nor does it mean that all features described by
> the Ada95 standard are implemented.  It merely means that the validation
> test suite was passed.
>
> Don't get me wrong, I think validation is a good thing.  But you must be
> careful about what it really means.
>
> BTW: I don't really care whether the compiler I use is validated, but it
is
> reassuring.
>






^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05 14:25             ` Marin David Condic
@ 2001-04-05 20:32               ` Robert A Duff
  2001-04-05 21:04                 ` Marin David Condic
  0 siblings, 1 reply; 33+ messages in thread
From: Robert A Duff @ 2001-04-05 20:32 UTC (permalink / raw)


"Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> writes:

> Well, I think it is true that *technically* speaking, an Ada compiler could
> read any Ada program and generate code that produced the exception
> Program_Error (or some other appropriate exception).(1) All you have to do
> is posit that the target implementation is too small to contain *any* legal
> Ada program of *any* size. This would be perfectly legal and presumably
> ought to pass the validation suite.

Yes, it's perfectly legal (presuming the target machine really is that
limited).

But no, it won't get validated.

- Bob



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05 20:32               ` Robert A Duff
@ 2001-04-05 21:04                 ` Marin David Condic
  2001-04-06 16:19                   ` Robert A Duff
  0 siblings, 1 reply; 33+ messages in thread
From: Marin David Condic @ 2001-04-05 21:04 UTC (permalink / raw)


I don't know why the actual hardware would have to be limited at all. The
implementation is pretty much free to define what parts of the actual
hardware it wants to utilize, isn't it? I recall Ada implementations that
did not take advantage of all the address space that may have been available
to them, so why couldn't an implementation limit its address space to one
byte? (Or just enough bytes to write "Program Error!" onto the screen?)
Worse comes to worse, I go off and invent "Marin's Virtual Machine" that
executes "Marin's Byte Code" - which has the quality of a very, very,
limited instruction set & memory.

Of course, there are other ways of building an unusable compiler by properly
defining implementation defined limits. How about a line length of 1? Or
zero?

Its a silly notion, but only brought up to illustrate that a legal
implementation of Ada can be totally useless.

Why wouldn't it (legally speaking) pass validation? It would produce correct
results, would it not? (In the sense that all programs would result in an
outcome that is legal within the definition of the language.)

Practically speaking, I'm sure that the keepers of the validation suite
would have better things to do than waste their time getting into the
Guinness Book Of World Records for validating the world's most useless
compiler. But that's not the same thing as saying there is a technical,
legal reason why such a compiler wouldn't pass.

MDC
--
Marin David Condic
Senior Software Engineer
Pace Micro Technology Americas    www.pacemicro.com
Enabling the digital revolution
e-Mail:    marin.condic@pacemicro.com
Web:      http://www.mcondic.com/


"Robert A Duff" <bobduff@world.std.com> wrote in message
news:wccsnjnjdev.fsf@world.std.com...

> Yes, it's perfectly legal (presuming the target machine really is that
> limited).
>
> But no, it won't get validated.
>





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 17:30 ` Ehud Lamm
@ 2001-04-05 22:04   ` Colin Paul Gloster
  2001-04-10  7:03     ` Simon Wright
  0 siblings, 1 reply; 33+ messages in thread
From: Colin Paul Gloster @ 2001-04-05 22:04 UTC (permalink / raw)


In article <9afpi0$irv$1@news.huji.ac.il>, Ehud Lamm wrote:

"Josef Widder <e9625114@student.tuwien.ac.at> wrote in message
news:MPG.1532ab1cc6ed7b4989682@news.chello.at...
> As project for university i'd like to compare the power of the Ada
> Generic construct relative to C++ templates.
>
> Could someone please tell me where to find good articles on the generic
> construct ?
>


In fact this is a pretty large subject. I'd restrict it to something more
managable (like "automatic instantiation vs. explicit instantiation" or the
way generic paramaters are specified etc.).

Some useful (I think) references are:
* the Ada83 Rationale chapter on generics
* Alexander Stepanov writings and intervies (some are available on the net,
and I gave URLs in this newsgroup a couple of times). He discusses some this
he considers shortcomings in Ada, as opposed to C++, as related to creating
the STL."

Specifically I would like to comment on the next bit before most of the
original content of this followup:
"* You may want to check specific uses. The are several examples of C++
temlate libraries that are hard if not impossible to mimic in Ada. Esp.
attempts at providing high-order programming facilties. (I don't have a URL
handy, but a search at http://lambda.weblogs.com should get you started. You
may also raise your question at that site)."

Do note that when The Booch Components were implemented in C++ the
implementation depended heavily on templates. Yet C++ did not have
concrete realisations of templates at the time. For example from page 6
of [2]:
"Type parameterization [..] Depending on a mechanism supporting this
abstraction was essentially a question of timing (of C++ language
release). In the end, we decided to provide an early implementation of
the  template  mechanism [Stroustrup88] as an interim measure."
and from page 7:
"Our design relied on several important abstraction concepts:
[..] type parameterization[..] We found the following mechanisms to be most
significant from a design perspective:
* [..]
*templates (type parameterization)
* [..]
* [..]
The existing (2.1) version of C++ provides mechanisms supporting the
first concept, future versions will support the next two[including
"templates (type parameterization)"], [..]"
and from page 8:
"We decided, instead, to built a filter which accepted the proposed C++
template mechanism. There are two parts to the mechanism: instantiating a
new class declaration, which happens upon encountering a declarative
use; and instantiating the class definition, which is done by
hand. Figure 11 illustrates how the template utility fits into the
compilation environment."
and from page 10:
"5.2 Conclusions
We found that the concepts of inheritance, composition, and type
parameterization were equally valuable aids in structuring the design.

[..]

It is nearly impossible to design a useful library of
collection/container data structures  without using type
parameterization. Implementing the template scheme proposed for C++ seems
to have been a reasonable investment for the resulting leverage gained
for this library.

C++ proved to be an effective language for implementing an
object-oriented design. The existing and planned features of C++
(especially templates and exceptions) are indeed useful for library
design. By conforming to the existing (and proposed)  standard C++
techniques, and adding a little support for features that are not yet
generally available, we were able to implement our design in C++."

Back to quoting Ehud Lamm:

"* Another thing that may be interesting is to check specific programming
styles. For example Ada's formal package paramters are a bit like using
classes to specify generic parameters, but they induce a different
programming style.

Any way, as I said, this is really a big subject. I suggest you check some
of these and focus your research on something a bit more specific. (Or more
general, like paramateric polymorphism in general).

I'd be glad to help. Email me or use the above mentioned site. (Or here, of
course).

Good luck,

Ehud Lamm"

Generics are used in The Booch Components (original Ada 83 version and
subsequent Ada 95 port). Pre-Ada 95 it was written on page 192 of "The
Design and Evolution of C++" [1] by Bjarne Stroustrup:
"[..Grady Booch implemented the Ada [83] version of The Booch Components
and he and Mike Vilot later implemented the C++ [of the time] version of
The Booch Components. The Ada [83] version] is 125,000 [since you
probably speak German I point out that 125,000 in English is equal to one
hundred and twentyfive thousand (big); not one hundrend and twentyfive
(small)] non-commented source lines compared to the C++ version's 10,000
[10000 not 10] lines - inheritance combined with templates can be a very
powerful mechanism for organising libraries without loss of performance
or clarity", referencing the second edition of "Object-oriented Analysis
and Design with Applications" by Grady Booch.

Remarkably Grady Booch and Mike Vilot did not mention this 12.5:1 ratio
in their paper "The Design of the C++ Booth Components" [2], ECOOP/OOPSLA
90 Proceedings October 21-25, 1990. Before I present extensive quoting
from [2] some of which still favourably rates the emerging C++ of the
time instead of Ada 83 despite the absence of an admission of such a
relative scale, see [3] for information on the porting of the C++ version
to Ada95 begun in 1994 (sic). Also you may find [4] useful.

You should probably be able to track down a copy of [2] if you do not
already have one. It may be stored as hardcopy paper in your library. If
not but you have access to the Association for Computing Machinery's
Digital Library then
http://WWW.ACM.org/pubs/citations/proceedings/oops/97945/p1-booch/ links
to an Adobe Acrobat .pdf version of the paper of size 1095370 bytes. If
you are not a paid up subscriber to the ACM DL (you do not seem to be as
the Find-A-Member facility did not show you on a search for
"Widder") perhaps your library is or perhaps one of your lecturers is. Be
warned however that this year some portions of the ACM website have been
a bit slow/unusable/unreachable.

Okay, excerpts from [2] follow.

Paragraph 3 of page 1:
"A key insight gained from this project: the design process centered on
developing a "template for the templates" - designing a component
framework and orderly process for generating the template classes."

Top of righthandside column on page 1:
"We learned an important lesson about designing with multiple class
lattices: the tradeoffs of various inheritance structures turned out to
be a fundamental design issue."

Top of righthandside column on page 4:
"3 Design - Key Abstractions
In the design of the library s key abstractions, we addressed four
fundamental issues:
* How to use inheritance
[..]

3.1 Using Inheritance
A drawback to the Ada design was redundancy: significant portions of the
library had similar, but slightly different implementations. This made it
an obvious candidate for implementation in an object-oriented programming
language. The use of inheritance was the most significant change in going
from an object-based design to an object-oriented one. The main issue was
whether or not to be "completely object-oriented" or just apply it where
it proved to be useful and effective. We chose a "forest" approach over a
"tree" approach for three reasons:

[..]"

On page 6:
"[..] we decided to provide an early implementation of the
"template" mechanism [Stroustrup88] as an interim measure."

Also on page 6:
"Clients can also avoid the overhead of indirect function calls in cases
where such performance issues are important. This exploits the difference
between in-line expansion during template compilation, and passing
function pointers in constructors during object creation."

From page 7:
"One aspect of exceptions in C++ not present in Ada is the opportunity to
combine them with inheritance. This provides a natural classification
mechanism (and the corresponding extensibility and flexibility to
clients)."

From page 7:
"4 Implementation - Mechanisms in C++
C++ provides many features that are helpful to those implementing
software intended for reuse. Indeed, much recent activity in evolving the
language has been specifically geared towards supporting library
development. Our design relied on several important abstraction
concepts: encapsulation, inheritance, composition, type parameterization,
exceptions, and concurrency. We found the following mechanisms to be most
significant from a design perspective:
*classes (especially inheritance)
*templates (type parameterization)
*exceptions (as a uniform error reporting mechanism)
* [..]
The existing (2.1) version of C++ provides mechanisms supporting the
first concept, future versions will support the next two, [..]"

Page 8 includes:
"The data structure classes simply invoke new and de1ete operations as
required. This turned out to be far simpler than the original Ada design,
which required a completely different syntax when using the library's
Storage Manager instead of the predefined free store operators."

Importantly on page 8:
"4.2 Templates Because type parameterization is central to the design of
the library, Ada's generic facility was widely used in the original
version."

Lower righthandside of page 9:
"5 Summary
The design of this library focused on:
[..]
* ways to structure and combine forms into templates
* effective implementation (C++ language features) of the mechanisms
(made easier with the addition of specific support)

The central design activity was careful consideration of the basic
"building block" components (the core data structures, the storage
managers). The key insight was designing a simple way of composing them
into the various templates in the library."

From page ten:
"It is nearly impossible to design a useful library of
collection/container data structures  without using type
parameterization. Implementing the template scheme proposed for C++ seems
to have been a reasonable investment for the resulting leverage gained
for this library.

C++ proved to be an effective language for implementing an
object-oriented design. The existing and planned features of C++
(especially templates and exceptions) are indeed useful for library
design. By conforming to the existing (and proposed) "standard
C++" techniques, and adding a little support for features that are not
yet generally available, we were able to implement our design in C++."

References and footnotes
/\/\/\/\/\/\/\/\/\/\/\/\
[1] "The Design and Evolution of C++" by Bjarne Stroustrup, ISBN
0-201-54330-3, published by Addison Wesley, there is a review on
http://www.accu.org/bookreviews/public/reviews/d/d000452.htm

Note that this is unlikely to be the book Georg Bauhaus
<sb463ba@l1-hrz.uni-duisburg.de> of Gerhard-Mercator-Universitaet -
Gesamthochschule Duisburg mentioned with timestamp Wed, 4 Apr 2001
13:24:26 +0000 (UTC) in
news:9af7aa$5io$1@a1-hrz.uni-duisburg.de
: "Bjarne Stroustrup's Book, 3rd ed., says where C++ templates
originally came from, namely a now outdated version of Ada
and CLU." That book is probably "The C++ Programming Language".

[2] "The Design of the C++ Booth Components" by Grady Booch and Michael
Vilot, ECOOP/OOPSLA  90 Proceedings October 21-25, 1990.
Permission to copy without fee all or part of this [the ECOOP/OOPSLA
paper] material is granted provided that the copies are not made or
distributed for direct commercial advantage, the ACM copyright notice and
the title of the publication and its date appear, and notice is given
that copying is by permission of the Association for Computing
Machinery. To copy otherwise, or to republish, requires a fee and/or
specific permission. (C) 1990 ACM 083791-411-2/90/0010-0001...$1.50

[3] HTTP://WWW.AdaPower.com/booch/overview.html	last updated in June 2000

[4] HTTP://WWW.AdaPower.com/original_booch/ which has amongst other
things Ada 83 and Ada 95 implementations' source code.	Last updated in
November 2000.

-- 
This signature file is included in protest against the hosting of Nazi
facist propaganda "Mein Kampf" written by Adolf Hitler on the Dublin City
University Networking Society (committee@RedBrick.DCU.Ie, DCU Networking
Society, c/o Clubs and Socs Office, The Hub, DCU, Glasnevin, Dublin 9,
Ireland) website at HTTP://WWW.RedBrick.DCU.Ie/~mellow/Adolf/ by
R. O'Brien whose username is mellow. On 22nd March 2001 Dublin City
University webmaster Niall O'Leary (niall.oleary@DCU.Ie, +353-1-700 5864, 
Room C203, Computer Services Department, Henry Grattan Building, DCU,
Glasnevin, Dublin 9, Ireland) authorised "Mein Kampf" to be on the
Internet via DCU and HEAnet (info@HEAnet.Ie, +353-1-6623412, HEAnet Ltd.,
Ground Floor, Marine House, Clanwilliam Court, Dublin 2, 
Ireland) resources. Please also complain to The President's Office, DCU,
Glasnevin, Dublin 9, Ireland, dcupres@DCU.Ie.



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-04 16:49           ` Ayende Rahien
@ 2001-04-05 22:31             ` Colin Paul Gloster
  0 siblings, 0 replies; 33+ messages in thread
From: Colin Paul Gloster @ 2001-04-05 22:31 UTC (permalink / raw)


In article <9afjmp$hud$1@taliesin.netcom.net.uk>, Ayende Rahien wrote:
""Jeffrey Carter" <jeffrey.carter@boeing.com> wrote in message
news:3ACB4A1B.1AC1ACF7@boeing.com...
> Francois Godme wrote:
> >
> > Even more, now that the language has been written down as a standard,
what can stop
> > the convergence of the C++ compilers to the standard?
>
> The desire of C++ compiler vendors to tie users to their compilers.

This is self evident by the fact that you can't pass ".h" files around C++
compilers (usually)."

I do not find myself denying the commoness of incompatibility of using
first party C++ header files and associated object code (even for the
same platform) on other vendors' C++ environments. Neither do I see
necessary grounds for a valid complaint in the observation made by Ayende
Rahien above. The Standard header files (which by the way in the
finalised Standard do not end in .h ever) are needed once per
implementation. I agree being able to try all vendors' implementations
of the libraries on all vendors' compiler implentations may be a boost to
choice on getting the optimum perfect solution. However if you have what
you need you do not need again in another form instead of what you have
already.

When it comes to using third party header files not in the Standard,
developers will find that there are important ones compatible with more
than one vendor's products: e.g. Rogue Wave's tools.h++ .
Colin Paul Gloster
-- 
This signature file is included in protest against the hosting of Nazi
facist propaganda "Mein Kampf" written by Adolf Hitler on the Dublin City
University Networking Society (committee@RedBrick.DCU.Ie, DCU Networking
Society, c/o Clubs and Socs Office, The Hub, DCU, Glasnevin, Dublin 9,
Ireland) website at HTTP://WWW.RedBrick.DCU.Ie/~mellow/Adolf/ by
R. O'Brien whose username is mellow. On 22nd March 2001 Dublin City
University webmaster Niall O'Leary (niall.oleary@DCU.Ie, +353-1-700 5864, 
Room C203, Computer Services Department, Henry Grattan Building, DCU,
Glasnevin, Dublin 9, Ireland) authorised "Mein Kampf" to be on the
Internet via DCU and HEAnet (info@HEAnet.Ie, +353-1-6623412, HEAnet Ltd.,
Ground Floor, Marine House, Clanwilliam Court, Dublin 2, 
Ireland) resources. Please also complain to The President's Office, DCU,
Glasnevin, Dublin 9, Ireland, dcupres@DCU.Ie.



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05  3:38           ` DuckE
  2001-04-05 14:25             ` Marin David Condic
@ 2001-04-06  0:37             ` James Rogers
  2001-04-06 10:38               ` Colin Paul Gloster
  1 sibling, 1 reply; 33+ messages in thread
From: James Rogers @ 2001-04-06  0:37 UTC (permalink / raw)


DuckE wrote:
> 
> You have implied that GNAT implements the entire Ada95 standard.
> 
> While all of the "required" elements are supported, some things are not.
> 
> Just try making use of "Ada.Asynchronous_Task_Control" and you'll get a
> message:
>   Asynchonnous_Task_Control is not implemented.

This, of course, does not even approach the problems found with C++
compilers.

I am sure you will correct me if I am wrong in this. I believe the C++
standard contains no optional annexes. 

GNAT does implement all required features of the Ada language, and
nearly every feature of the optional annexes. You cannot write an Ada
program that compiles in GNAT, using only required features of the 
language, and not successfully compile the same program using another
Ada compiler.

On the other hand, you can easily write a C++ program using the
Microsoft C++ compiler that will not compile properly using the
Watcom C++ compiler. 

The C++ reference manual is larger than the Ada reference manual.
This is only important as an indication of the difficulty of
compiler implementation implied by the size of the document. You
may deny the validity of this measure, but the current lack of
compilers implementing the standard speaks loudly to me. It must be
due to the standard itself. The C++ language standard has too often
ignored the concerns of compiler writers. Features and language
definitions have been placed in the standard to satisfy application
developers without proper concern for the need to implement those
features in a compiler.

Jim Rogers
Colorado Springs, Colorado USA



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-06  0:37             ` James Rogers
@ 2001-04-06 10:38               ` Colin Paul Gloster
  2001-04-11  3:33                 ` Stephen Howe
  0 siblings, 1 reply; 33+ messages in thread
From: Colin Paul Gloster @ 2001-04-06 10:38 UTC (permalink / raw)


In article <3ACD1045.E9ECB65F@worldnet.att.net>, James Rogers wrote:
"DuckE wrote:
> 
> You have implied that GNAT implements the entire Ada95 standard.
> 
> While all of the "required" elements are supported, some things are not.
> 
> Just try making use of "Ada.Asynchronous_Task_Control" and you'll get a
> message:
>   Asynchonnous_Task_Control is not implemented.

This, of course, does not even approach the problems found with C++
compilers.

I am sure you will correct me if I am wrong in this. I believe the C++
standard contains no optional annexes."

Probably true that it has no optional annexes.

"GNAT does implement all required features of the Ada language, and
nearly every feature of the optional annexes. You cannot write an Ada
program that compiles in GNAT, using only required features of the 
language, and not successfully compile the same program using another
Ada compiler.

On the other hand, you can easily write a C++ program using the
Microsoft C++ compiler that will not compile properly using the
Watcom C++ compiler."

Watcom having gone bust before the Standard came to be. As for those
current Standard-sriving compilers, your point holds. There are people
who care though and do get more than one C++ compiler to successfully
compile the same source.

"The C++ reference manual is larger than the Ada reference manual.
This is only important as an indication of the difficulty of
compiler implementation implied by the size of the document. You
may deny the validity of this measure,"

I agree that it is indicative. Something I do not like is people
referencing "The C++ Programming Language" (or the second edition of 
"The C Programming Language", 1988, Prentice Hall in the case of C89 when
C89 was Standard C) as authoriative when they are not prescriptive -- the
Standard is the authority. Note even that "The C Programming
Language" predates the ex-standard people incorrectly throw it around as
defining and is based on a late draft standard.

It may be worth mentioning that staff writers for "C/C++ User's
Journal" have said things along the lines of such and such seems to be
the case in Standard C++, evidence to support said opinion (note
opinion and evidence, not things they are billing as definitely
correct interpretations of the Standard) being from whatever section (of
the actual Standard thank goodness). The editor said that because of such
common referrals to the C++ Standard in CUJ, the Standard is
excellent. Merely on that measure the opposite is a far more sensible
suspicion.

"but the current lack of compilers implementing the standard speaks
loudly to me. It must be due to the standard itself."

Yes. Note however that on average the greatest deficiencies in
completely implementating it seems to be in finishing off the
libraries. Libraries are not so much a language issue. Still the actual
language implementations have some way to go yet.

"The C++ language standard has too often ignored the concerns of compiler
writers. Features and language definitions have been placed in the
standard to satisfy application developers without proper concern for the
need to implement those features in a compiler."

My reaction to this makes me feel that it is grossly untrue.
Colin Paul
-- 
This signature file is included in protest against the hosting of Nazi
facist propaganda "Mein Kampf" written by Adolf Hitler on the Dublin City
University Networking Society (committee@RedBrick.DCU.Ie, DCU Networking
Society, c/o Clubs and Socs Office, The Hub, DCU, Glasnevin, Dublin 9,
Ireland) website at HTTP://WWW.RedBrick.DCU.Ie/~mellow/Adolf/ by
R. O'Brien whose username is mellow. On 22nd March 2001 Dublin City
University webmaster Niall O'Leary (niall.oleary@DCU.Ie, +353-1-700 5864, 
Room C203, Computer Services Department, Henry Grattan Building, DCU,
Glasnevin, Dublin 9, Ireland) authorised "Mein Kampf" to be on the
Internet via DCU and HEAnet (info@HEAnet.Ie, +353-1-6623412, HEAnet Ltd.,
Ground Floor, Marine House, Clanwilliam Court, Dublin 2, 
Ireland) resources. Please also complain to The President's Office, DCU,
Glasnevin, Dublin 9, Ireland, dcupres@DCU.Ie.



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05 21:04                 ` Marin David Condic
@ 2001-04-06 16:19                   ` Robert A Duff
  0 siblings, 0 replies; 33+ messages in thread
From: Robert A Duff @ 2001-04-06 16:19 UTC (permalink / raw)


"Marin David Condic" <marin.condic.auntie.spam@pacemicro.com> writes:

>...I recall Ada implementations that
> did not take advantage of all the address space that may have been available
> to them, so why couldn't an implementation limit its address space to one
> byte?

> Why wouldn't it (legally speaking) pass validation?

Because it wouldn't pass the validation tests, of course!

- Bob



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-02 14:28 Ada Generic vs. C++ Templates Josef Widder
                   ` (2 preceding siblings ...)
  2001-04-04 17:30 ` Ehud Lamm
@ 2001-04-08  5:00 ` Lao Xiao Hai
  3 siblings, 0 replies; 33+ messages in thread
From: Lao Xiao Hai @ 2001-04-08  5:00 UTC (permalink / raw)




Josef Widder wrote:

> As project for university i'd like to compare the power of the Ada
> Generic construct relative to C++ templates.

With the exception of Ehud Lamm and a few others, I find the responses we
have
given rather unfortunate.  Here is someone asking for the answer to a
question and
we start an argument about "how many angels can dance on the head of a
pin."

I will send him the chapter from my still unpublished book that deals with
generics
along with some sample code.   He can study it and come to his own
conclusions.
May I suggest that others of us also send him code samples and examples he
can
use in completing his study?

Sorry to sound so grumpy about this.  There are those researchers out there
who
are genuinely interested in the answers to the problems they are trying to
solve.

Richard Riehle




^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-05 22:04   ` Colin Paul Gloster
@ 2001-04-10  7:03     ` Simon Wright
  2001-04-13 14:11       ` Pat Rogers
  0 siblings, 1 reply; 33+ messages in thread
From: Simon Wright @ 2001-04-10  7:03 UTC (permalink / raw)


Colin_Paul_Gloster@ACM.org (Colin Paul Gloster) writes:

> Generics are used in The Booch Components (original Ada 83 version and
> subsequent Ada 95 port). Pre-Ada 95 it was written on page 192 of "The
> Design and Evolution of C++" [1] by Bjarne Stroustrup:
> "[..Grady Booch implemented the Ada [83] version of The Booch Components
> and he and Mike Vilot later implemented the C++ [of the time] version of
> The Booch Components. The Ada [83] version] is 125,000 [since you
> probably speak German I point out that 125,000 in English is equal to one
> hundred and twentyfive thousand (big); not one hundrend and twentyfive
> (small)] non-commented source lines compared to the C++ version's 10,000
> [10000 not 10] lines - inheritance combined with templates can be a very
> powerful mechanism for organising libraries without loss of performance
> or clarity", referencing the second edition of "Object-oriented Analysis
> and Design with Applications" by Grady Booch.

The C++ BCs I was given a copy of when I started maintaining the Ada95
port have 29_000 non-comment source lines. The Ada95 port has 13_000
non-comment source lines.

The Ada port is incomplete; few of the Components have the synchronized
forms as yet (I'm puzzled by what to do about iterators & synchronized
forms, though the C++ version seems to punt on this too), and there
are no released Tools as yet (working on a Quick and Shell sort). Of
course there's no need for a port of the String classes to Ada.



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-06 10:38               ` Colin Paul Gloster
@ 2001-04-11  3:33                 ` Stephen Howe
  2001-04-11 14:33                   ` Colin Paul Gloster
  0 siblings, 1 reply; 33+ messages in thread
From: Stephen Howe @ 2001-04-11  3:33 UTC (permalink / raw)


> Watcom having gone bust before the Standard came to be.

Not so. See www.openwatcom.org

Stephen Howe





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-11  3:33                 ` Stephen Howe
@ 2001-04-11 14:33                   ` Colin Paul Gloster
  0 siblings, 0 replies; 33+ messages in thread
From: Colin Paul Gloster @ 2001-04-11 14:33 UTC (permalink / raw)


In article <3ad3d0a0$0$15025$cc9e4d1f@news.dial.pipex.com>, Stephen Howe wrote:
"> Watcom having gone bust before the Standard came to be.

Not so. See www.openwatcom.org

Stephen Howe"

Okay, point taken that the company Sybase did not go bust but the Open
Sourced Watcom C/C++ is pre-Standard I strongly suspected and have
confirmed. It has not reached nor surpassed version number twelve (it is
on eleven (disregarding minor version portion c) and it was on ten or
eleven (again ommitting minor version distinguishers) when it was Open
Sourced. Version 10/11 was supplied with books and hardcopy documentation
if the customer paid extra: if memory serves correctly the edition of "The
C++ Programming Language" in the pack is the second (i.e. quasi-ARM, the
basis for interim drafts) yet the current editions are the third and
special ones.

On slide 14 (page 8) of http://www.openwatcom.org/reference.html --> 
Watcom C/C++ Getting Started (i.e. ftp://ftp.openwatcom.org/creadme.pdf ) 
(dated 14th November 2000) the two suggested C++ books are dated 1991 and
1994.

Before looking at its newsgroup archives for the past month (failed to
summon the email archives properly) it appeared to me that the Open Watcom
effort at present seems more concerned with removing intellectual property
than evolving the tools to Standard C++. Looking at some posts for the
past month partially removed that suspicion but Stephen Howe in a
small thread you yourself took part in Kendall Bennett said
"the Open Watcom 1.0 compiler will essentially be the Open Source 
version of the 11.0c compiler. We don't plan to make any sweeping 
changes to the compiler until it is released in an Open Source format. 
Once Open Watcom 1.0 is out, we certainly hope that people will actively 
work on improving the compiler to be ANSI C++ compliant."

As Stephen Howe pointed out in his post Watcom C/C++ is not a Standard C++
compiler and at least for the present is not intended to be a contender:
"Eugene Gavrilov <eugeneg@windoms.sitek.net> wrote in message
news:3aae68eb@news.scitechsoft.com...
> Will the OpenWatcom 1.0 be a C++ Stroustrup's 3rd edition compiler?

Unlikely.
It does what you mention but not fully (no default template parameters, no
member templates, no partial specialisation, no std:: namespace).

The brief by the OpenWatcom team from Sybase is to get the project viable
first. I should imagine that there are areas where we will try and get
OpenWatcom closer to ISO C++.

Stephen Howe [TeamSybase]".



^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-10  7:03     ` Simon Wright
@ 2001-04-13 14:11       ` Pat Rogers
  2001-04-17  8:27         ` Colin Paul Gloster
  0 siblings, 1 reply; 33+ messages in thread
From: Pat Rogers @ 2001-04-13 14:11 UTC (permalink / raw)


"Simon Wright" <simon@pushface.org> wrote in message
news:x7v66gdw82g.fsf@smaug.pushface.org...
> Colin_Paul_Gloster@ACM.org (Colin Paul Gloster) writes:
>
> > Generics are used in The Booch Components (original Ada 83 version and
> > subsequent Ada 95 port). Pre-Ada 95 it was written on page 192 of "The
> > Design and Evolution of C++" [1] by Bjarne Stroustrup:
> > "[..Grady Booch implemented the Ada [83] version of The Booch Components
> > and he and Mike Vilot later implemented the C++ [of the time] version of
> > The Booch Components. The Ada [83] version] is 125,000 [since you
> > probably speak German I point out that 125,000 in English is equal to
one
> > hundred and twentyfive thousand (big); not one hundrend and twentyfive
> > (small)] non-commented source lines compared to the C++ version's 10,000
> > [10000 not 10] lines - inheritance combined with templates can be a very
> > powerful mechanism for organising libraries without loss of performance
> > or clarity", referencing the second edition of "Object-oriented Analysis
> > and Design with Applications" by Grady Booch.
>
> The C++ BCs I was given a copy of when I started maintaining the Ada95
> port have 29_000 non-comment source lines. The Ada95 port has 13_000
> non-comment source lines.

Another point is that the Booch C++ design for the components is very --
repeat very -- different from the Ada design, so comparing sizes is
difficult.  It is not a matter of inheritance.  There is in fact a lot of
replication in the first design that he realized he could avoid, which has
absolutely nothing at all to do with the language chosen.  It is a matter of
the second design benefiting from the first.

Second, there is little inheritance in the C++ version.  It is not the
central design approach, as it would be in say Java or Eiffel.  No one
should conclude that inheritance is the central reason for the difference in
size.

---
Patrick Rogers                       Consulting and Training in:
http://www.classwide.com        Real-Time/OO Languages
progers@classwide.com          Hard Deadline Schedulability Analysis
(281)648-3165                          Software Fault Tolerance





^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: Ada Generic vs. C++ Templates
  2001-04-13 14:11       ` Pat Rogers
@ 2001-04-17  8:27         ` Colin Paul Gloster
  0 siblings, 0 replies; 33+ messages in thread
From: Colin Paul Gloster @ 2001-04-17  8:27 UTC (permalink / raw)


In article <qODB6.91$ow5.12326@nnrp1.sbc.net>, Pat Rogers wrote:
""Simon Wright" <simon@pushface.org> wrote in message
news:x7v66gdw82g.fsf@smaug.pushface.org...
> Colin_Paul_Gloster@ACM.org (Colin Paul Gloster) writes:
>
> > [..] The Booch Components [..]
> > [..] Pre-Ada 95 it was written on page 192 of "The
> > Design and Evolution of C++" [1] by Bjarne Stroustrup:
> > "[..Grady Booch implemented the Ada [83] version of The Booch Components
> > and he and Mike Vilot later implemented the C++ [of the time] version of
> > The Booch Components. The Ada [83] version] is 125,000 [since you
> > probably speak German I point out that 125,000 in English is equal to one
> > hundred and twentyfive thousand (big); not one hundrend and twentyfive
> > (small)] non-commented source lines compared to the C++ version's 10,000
> > [10000 not 10] lines - inheritance combined with templates can be a very
> > powerful mechanism for organising libraries without loss of performance
> > or clarity", referencing the second edition of "Object-oriented Analysis
> > and Design with Applications" by Grady Booch.
>
> The C++ BCs I was given a copy of when I started maintaining the Ada95
> port have 29_000 non-comment source lines. The Ada95 port has 13_000
> non-comment source lines.

Another point is that the Booch C++ design for the components is very --
repeat very -- different from the Ada design, so comparing sizes is
difficult.  It is not a matter of inheritance.  There is in fact a lot of
replication in the first design that he realized he could avoid, which has
absolutely nothing at all to do with the language chosen.  It is a matter of
the second design benefiting from the first.

Second, there is little inheritance in the C++ version.  It is not the
central design approach, as it would be in say Java or Eiffel.  No one
should conclude that inheritance is the central reason for the difference in
size."

It is peculiar that Bjarne Stroustrup said that the C++ version had 10 000
(non-comment?) source lines but Simon Wright has instead found nearly triple
that excluding comments. The paper quoted from by Mike Vilot and Grady
Booch did not give their sizes. Any one know what is going on?



^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2001-04-17  8:27 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-02 14:28 Ada Generic vs. C++ Templates Josef Widder
2001-04-02 14:38 ` Ted Dennison
2001-04-02 20:57   ` Francois Godme
2001-04-02 21:26     ` Ted Dennison
2001-04-03  0:53       ` David Starner
2001-04-04  7:12         ` Pascal Obry
2001-04-04 12:37         ` Stephen Leake
2001-04-04 14:16         ` Ted Dennison
2001-04-03 22:09       ` Francois Godme
2001-04-04 16:17         ` Brian Rogoff
2001-04-04 16:21         ` Jeffrey Carter
2001-04-04 16:49           ` Ayende Rahien
2001-04-05 22:31             ` Colin Paul Gloster
2001-04-04 16:56           ` Ted Dennison
2001-04-04 17:02             ` Ayende Rahien
2001-04-05  0:35         ` James Rogers
2001-04-05  3:38           ` DuckE
2001-04-05 14:25             ` Marin David Condic
2001-04-05 20:32               ` Robert A Duff
2001-04-05 21:04                 ` Marin David Condic
2001-04-06 16:19                   ` Robert A Duff
2001-04-06  0:37             ` James Rogers
2001-04-06 10:38               ` Colin Paul Gloster
2001-04-11  3:33                 ` Stephen Howe
2001-04-11 14:33                   ` Colin Paul Gloster
2001-04-04 13:24 ` Georg Bauhaus
2001-04-05  8:46   ` Jean-Marc Bourguet
2001-04-04 17:30 ` Ehud Lamm
2001-04-05 22:04   ` Colin Paul Gloster
2001-04-10  7:03     ` Simon Wright
2001-04-13 14:11       ` Pat Rogers
2001-04-17  8:27         ` Colin Paul Gloster
2001-04-08  5:00 ` Lao Xiao Hai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox