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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!postnews.google.com!79g2000cws.googlegroups.com!not-for-mail From: "Hyman Rosen" Newsgroups: comp.lang.ada Subject: Re: Ada generics Date: 22 Dec 2006 08:14:29 -0800 Organization: http://groups.google.com Message-ID: <1166804069.272572.113500@79g2000cws.googlegroups.com> References: <1166710494.869393.108730@a3g2000cwd.googlegroups.com> <17fe4xfogg7p5.1dcyc5nyc2gsl.dlg@40tude.net> <458B9062.3000400@users.sourceforge.net> NNTP-Posting-Host: 204.253.248.208 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1166804075 3583 127.0.0.1 (22 Dec 2006 16:14:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 22 Dec 2006 16:14:35 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1; .NET CLR 2.0.50727) Gecko/20061204 Firefox/2.0.0.1,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 79g2000cws.googlegroups.com; posting-host=204.253.248.208; posting-account=lJDDWg0AAACmMd7wLM4osx8JUCDw_C_j Xref: g2news2.google.com comp.lang.ada:7990 Date: 2006-12-22T08:14:29-08:00 List-Id: Martin Krischik wrote: > Dmitry A. Kazakov schrieb: > > > 2. Support separate compilation (1 is a premise to have this) > > C++ 2003 now has "export" templates which promises separate compilation. > But it is an optional feature and only one compiler [1] implements it. I > guess it is missing point 1 which makes it so difficult. Remember that C++ templates support specializations while Ada generics do not. That means that instantiating a generic will depend much more heavily on the parameters than is the case in Ada. In the same vein, the automatic type conversions that C++ supports and Ada does not also affect the instantiated code. This makes compiling a template itself not a terribly useful operation. The compiler can verify syntactical correctness and can bind some names which are not dependent on the parameters, but it can do very little else until instantiation. Furthermore, because of the popularity of template metaprogramming, compilers know to apply intensive inlining while compiling instantiations, lessening the meaningfulness of separate compilation even more.