Question on Octal

Jonathan M Davis jmdavisProg at gmx.com
Wed Aug 15 21:20:32 PDT 2012


On Thursday, August 16, 2012 06:14:23 Simen Kjaeraas wrote:
> 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.

Well, if no member matches the template name, then it's not an eponymous 
template, and different rules apply.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list