comp.lang.ada
 help / color / mirror / Atom feed
From: Hyman Rosen <hyrosen@mail.com>
Subject: Re: Ada generics
Date: Mon, 25 Dec 2006 14:20:35 GMT
Date: 2006-12-25T14:20:35+00:00	[thread overview]
Message-ID: <T6Rjh.1224$oo4.1212@trndny09> (raw)
In-Reply-To: <06tzznwsso.fsf@hod.lan.m-e-leypold.de>

Markus E Leypold wrote:
> But that is not enough. A language specification essentially provides
> a vocabulary to describe interfaces between system components. It
> talks about types, language objects that are in interfaces, which
> parts of them are visible and what might be the permitted usage.

With C++ templates you do that by reading the entire source of the
template. It's not unlike the other message recently posted which
complained of GNAT needing source code to perform inlining. If you
want a specification, you need to design the specification language
and it has to be expressive enough to say everything you need. In
the case of C++ templates, that's relatively difficult, and so the
source of the template itself serves as the specification for what
it accepts. Perhaps it's weird and chaotic, but it pretty much works.

> You only have to do all that if you "instantiate" templates in header
> files. ... no need to generate code and no need to fold multiple
> instantiation with the same parameters into one.

Header files have nothing to do with it, and there is every need to
do instantiation folding. C++ templates are not Ada generics. They are
all instantiated at compile time, and specialization means that the
distinction between an instantiation using one set of types or another
can be vastly greater than just a few layout parameters. If you don't
understand this essential difference, you're just going to be very
confused.

> In Ada -- as I understand it -- an instantiation is simply identified
> by the place where the package is instantiated.

Except that each time through the instantiation, the parameters aren't
necessarily the same, since there can be array sizes and subtypes and
discriminants involved.

> This approach is of cause not possible with header files (inclusion
> vs. usage).

Header files are a red herring. There are essential, not superficial,
language differences going on.

> Have you ever tried to rebuild a C++-projekt from last
> year or from 5 years ago?

Ugh. Have I ever. The main problem in this respect with C++ was that
the language became popular well ahead of its standard. That meant
that a million implementations bloomed, and vendors kept scrambling
to keep old code working while trying to adopt the new features in
the standard. Then the standard itself was hamstrung trying to not
break too much old code. I absolutely agree that the state of C++
code and the state of C++ compilers, and to some extent the state of
the standard itself, is a total mess.



  parent reply	other threads:[~2006-12-25 14:20 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-21 14:14 Ada generics markww
2006-12-21 15:42 ` Dmitry A. Kazakov
2006-12-22  7:59   ` Martin Krischik
2006-12-22 16:14     ` Hyman Rosen
2006-12-22  7:59   ` Martin Krischik
2006-12-22 16:41   ` Hyman Rosen
2006-12-22 17:33     ` Markus E Leypold
2006-12-22 18:26       ` Hyman Rosen
2006-12-22 20:59         ` Markus E Leypold
2006-12-22 21:01           ` Markus E Leypold
2006-12-23 14:09           ` Marco
2006-12-25 14:23             ` Hyman Rosen
2006-12-29 14:13               ` Marco
2006-12-25 14:20           ` Hyman Rosen [this message]
2006-12-23 11:43     ` Dmitry A. Kazakov
2006-12-25 13:49       ` Hyman Rosen
2006-12-25 14:39         ` Dmitry A. Kazakov
2006-12-26  1:34           ` Hyman Rosen
2006-12-26  9:11             ` Dmitry A. Kazakov
2006-12-26 16:23               ` Hyman Rosen
2006-12-26 19:28                 ` Dmitry A. Kazakov
2006-12-27  1:44                   ` Hyman Rosen
2006-12-27  9:21                     ` Dmitry A. Kazakov
2006-12-27 19:06                       ` Hyman Rosen
2006-12-28 10:59                         ` Dmitry A. Kazakov
2006-12-28 16:29                           ` Hyman Rosen
2006-12-29 11:12                             ` Dmitry A. Kazakov
2006-12-29 14:56                               ` Hyman Rosen
2006-12-28 17:35                           ` Georg Bauhaus
2006-12-29 14:48                             ` Dmitry A. Kazakov
2006-12-29 19:39                               ` Georg Bauhaus
2006-12-30  9:58                                 ` Dmitry A. Kazakov
2006-12-30 14:53                                   ` Georg Bauhaus
2007-01-01 13:00                                     ` Dmitry A. Kazakov
2007-01-02 10:04                                       ` Georg Bauhaus
2007-01-02 11:11                                         ` Dmitry A. Kazakov
2007-01-02 12:33                                           ` Georg Bauhaus
2007-01-02 13:51                                             ` Dmitry A. Kazakov
2007-01-02 14:45                                               ` Georg Bauhaus
2007-01-03 10:10                                                 ` Dmitry A. Kazakov
2007-01-03 14:20                                                   ` Hyman Rosen
2007-01-03 14:55                                                   ` Georg Bauhaus
2007-01-04 10:15                                                     ` Dmitry A. Kazakov
2007-01-03 19:33                                           ` Alexander E. Kopilovich
2007-01-04 10:27                                             ` Dmitry A. Kazakov
2007-01-04 15:00                                               ` Alexander E. Kopilovich
2007-01-05 10:32                                                 ` Dmitry A. Kazakov
2006-12-30  2:25                               ` Randy Brukardt
2006-12-30 10:13                                 ` Dmitry A. Kazakov
2007-01-04  1:09                                   ` Randy Brukardt
2007-01-04 10:07                                     ` Dmitry A. Kazakov
2007-01-05  1:32                                       ` Randy Brukardt
2007-01-05  4:46                                         ` Randy Brukardt
2007-01-05  9:08                                         ` Jean-Pierre Rosen
2007-01-05 20:14                                         ` Georg Bauhaus
2007-01-06  0:14                                           ` Randy Brukardt
2006-12-29  0:09                           ` Randy Brukardt
2006-12-29 11:11                             ` Dmitry A. Kazakov
2006-12-30  2:40                               ` Randy Brukardt
2006-12-21 16:55 ` Hyman Rosen
2006-12-21 18:22   ` markww
2006-12-22  3:01 ` Steve
replies disabled

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