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,e93f73587e2bc1c3 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx01.iad01.newshosting.com!newshosting.com!novia!transit3.readnews.com!news-out.readnews.com!postnews3.readnews.com!not-for-mail Date: Wed, 28 Jul 2010 07:27:33 -0400 From: "Peter C. Chapin" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.7) Gecko/20100713 Lightning/1.0b2 Thunderbird/3.1.1 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Sharing generic bodies across instantiations. References: <4c4e2d69$0$2378$4d3efbfe@news.sover.net> <4c4f5c28$0$2375$4d3efbfe@news.sover.net> <7da1e21f-bec7-4607-923c-0fd6cbcfc753@t10g2000yqg.googlegroups.com> In-Reply-To: <7da1e21f-bec7-4607-923c-0fd6cbcfc753@t10g2000yqg.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4c501408$0$2382$4d3efbfe@news.sover.net> Organization: SoVerNet (sover.net) NNTP-Posting-Host: c9b6572f.news.sover.net X-Trace: DXC=8DHW0YV83AN0gYVRhloIOBK6_LM2JZB_CJ5R`gYClY@N:WUUlR<856OE63P]j`jB2MPD@ldP:eUgF X-Complaints-To: abuse@sover.net Xref: g2news1.google.com comp.lang.ada:12627 Date: 2010-07-28T07:27:33-04:00 List-Id: On 2010-07-28 03:59, Maciej Sobczak wrote: > To be honest I'm not sure why you came up with such an idea. > Formally, the C++ standard places no restrictions on how this should > be done. I understand that there is no statement in the C++ standard that says template bodies can't be shared. My assumption has been that such a conclusion follows indirectly from the other requirements. I admit that I'm not a C++ implementer but I know that in general C++ imposes few restrictions on the way names in templates are used. Since those names can be dependent on template parameters there would be a large number of corner cases to support that might make a shared implementation model "unreasonably" difficult. For example template< typename T > void f(const T &object) { typename T::helper internal; ... } Here T::helper might be a class or a typedef. Depending on what it is a wide variety of uses are possible. Dealing with all of these variations in a shared implementation model would be quite a burden on the compiler, it seems like. It might not be theoretically impossible but it might be practically infeasible. There could well be other corner cases I'm not seeing right now... that is the 'nature' of C++ of which I spoke. I realize that implementing the shared model in Ada would be hard as well, but Ada constrains much more the way names in generic bodies can be used. I speculate that those limitations make implementing the shared model in Ada easier and, in particular, easy enough to be feasible and useful. Is that actually true? That's the essence of my original question. > But, for the sake of exercise, think about a C++ *interpreter*. That seems like a different situation to me. A pure interpreter executes code only as needed and only when needed. Without a compilation step isn't the question of shared or replicated bodies meaningless? Everything is shared... or maybe everything is replicated... it would depend on how one defined one's terms. Peter