import concerns (C++ visib question)
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Sun Jul 9 09:42:33 PDT 2006
Walter Bright wrote:
> Bruno Medeiros wrote:
>> Well, that clearly states that private members should not be invisible
>> in C++, but I'm having trouble understanding why. He says "Without it,
>> private out-of-class member declarations become impractical to parse
>> in the general case." but I don't see how or why, anyone has an
>> example or clarification?
>
> I don't understand that, either.
>
> My best guess is that getting consistent overloading results when
> changing protections was deemed by Bjarne to be less surprising, but I'm
> just guessing.
Well the "become impractical to parse in the general case" part makes me
think it would be a hard-constraint: it would make something broken or
unfeasible, not just strange or surprising. If you find anything let us
know.
BTW, I'm only asking this out of curiosity, I don't think it has a
bearing on D semantics. It seems to me it would be quite feasible for D
not to consider private overloads in its name lookup. (or any other
non-acessible names)
Alternatively, we could require that any name overloads have the same
protection level. It doesn't seem to be a bad solution. It is considered
good practice that the semantics of overloaded functions are closely
related, so maybe so should the protection level be.
--
Bruno Medeiros - CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list