Question on Octal

Simen Kjaeraas simen.kjaras at gmail.com
Wed Aug 15 21:14:23 PDT 2012


On Wed, 15 Aug 2012 20:07:59 +0200, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

>> 1) The specification is clear that the if the template has only
>> one member and the member has the same name with the template's,
>> the member is implicitly referred to in the instantiation. The
>> template octal has two members, so the program should not really
>> be compiling, and yet it does. Is this a compiler bug?
>
> If the spec says that you can only have one member in an eponymous  
> template,
> then it's wrong and needs to be updated. All of the symbols which don't  
> match
> the template name are private and are used only as helpers. TDPL (The D
> Programming Language by Andrei Alexandrescu) gives the correct  
> description.

And those symbols are only private if there is a member that matches the
template name. Otherwise you'd have to resort to ugkly hacks to keep more
than one piece of information in a template.


-- 
Simen


More information about the Digitalmars-d-learn mailing list