From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a84eaf8fb2470909 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.glorb.com!cycny01.gnilink.net!spamkiller2.gnilink.net!gnilink.net!trndny09.POSTED!0e8a908a!not-for-mail From: Hyman Rosen User-Agent: Thunderbird 1.5.0.9 (Windows/20061207) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada generics References: <1166710494.869393.108730@a3g2000cwd.googlegroups.com> <17fe4xfogg7p5.1dcyc5nyc2gsl.dlg@40tude.net> <1166805696.291429.239590@48g2000cwx.googlegroups.com> <1166811980.980627.270680@a3g2000cwd.googlegroups.com> <06tzznwsso.fsf@hod.lan.m-e-leypold.de> In-Reply-To: <06tzznwsso.fsf@hod.lan.m-e-leypold.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Mon, 25 Dec 2006 14:20:35 GMT NNTP-Posting-Host: 70.19.111.106 X-Complaints-To: abuse@verizon.net X-Trace: trndny09 1167056435 70.19.111.106 (Mon, 25 Dec 2006 09:20:35 EST) NNTP-Posting-Date: Mon, 25 Dec 2006 09:20:35 EST Xref: g2news2.google.com comp.lang.ada:8009 Date: 2006-12-25T14:20:35+00:00 List-Id: 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.