From -6570464981146296184
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,c45bddfadd5b4855
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 1994-09-15 09:34:17 PST
Newsgroups: comp.std.c++
Path: bga.com!news.sprintlink.net!uunet!MathWorks.Com!yeshua.marcam.com!charnel.ecst.csuchico.edu!csusac!csus.edu!netcom.com!rfg
From: rfg@netcom.com (Ronald F. Guilmette)
Subject: Re: C++ templates standard
Message-ID: <rfgCw42n2.Lxt@netcom.com>
Organization: Netcom Online Communications Services (408-241-9760 login: guest)
References: <CvpIE8.K1@hpgndlab.grenoble.hp.com> <JASON.94Sep7141307@deneb.cygnus.com> <Cw06vx.1yu@hpgndlab.grenoble.hp.com>
Date: Wed, 14 Sep 1994 08:37:49 GMT
Lines: 48

In article <Cw06vx.1yu@hpgndlab.grenoble.hp.com> jr@grenoble.hp.com (Jean-Rene Bouvier) writes:
>In article <JASON.94Sep7141307@deneb.cygnus.com>, jason@cygnus.com (Jason Merrill) writes:
>> >>>>> Jean-Rene Bouvier <jr@grenoble.hp.com> writes:
>> 
>> > I've tried several compilers for the following piece of code, but none
>> > accepted it.
>> > Does anyone know whether my code is legal or not ?
>> 
>> It isn't.  Class templates cannot be nested.
>> 
>> Jason
>
>Is there any reason - besides compilers complexity - to forbid nested
>templates.

Not that I can think of.  The only excuse for this particular bit of non-
orthogonality in the language that I can even imagine is that once upon a
time, templates were implemented via macro-processing... and macro processors
tend not to understand such things as nested scopes.

Given that those times have now passed, I also would like to know why
templates cannot be nested.

>I can't see why there would be an issue with them...

Me neither.

>has that question been debated at ANSI ?

Not as far as I know.  Up until quite recently, the standardization
committee has been too busy shoveling new stuff into the language
wholesale to spend very much time looking back and wondering about
the quirks of the *existing* language features.  (I should say however
that there are many valiant souls... not the least of which is John
Spicer of EDG, who has done one hell of a lot of work on templates...
who have been working hard for a long long time to put putty in all
those annoying little holes.)

>BTW: none of my compilers told me I was using an illegal construct; indeed one
>of them even spat a 'sorry, not implemented...

Well... so it's not implemented. :-)

-- 

-- Ron Guilmette, Sunnyvale, CA ---------- RG Consulting -------------------
---- domain addr: rfg@netcom.com ----------- Purveyors of Compiler Test ----
---- uucp addr: ...!uunet!netcom!rfg ------- Suites and Bullet-Proof Shoes -


