Implicit template properties
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Mar 9 10:39:20 PST 2007
Neal Becker wrote:
> I'm reading D specification, and I found:
> "If a template has exactly one member in it, and the name of that member is
> the same...".
>
> That strikes me as strange. It seems reasonable to use the name as a
> trigger for the Implicit template property feature, but what is the reason
> for the restriction to 'exactly one member'?
Because the other names otherwise wouldn't be (externally) accessible
any more, I guess.
Though that reason only applies when the others aren't private[1], which
is why there have been suggestions to change this rule to "one _public_
member" instead of "one member"...
[1]: I'm not sure if private template members are accessible from the
rest of the module they're declared in, like class & struct members. If
they are, that might screw things up.
More information about the Digitalmars-d
mailing list