Should protection attributes disambiguate?
Nick Sabalausky
a at a.a
Mon Jun 20 15:43:35 PDT 2011
"Nick Sabalausky" <a at a.a> wrote in message
news:itoiji$2hsk$1 at digitalmars.com...
> "Peter Alexander" <peter.alexander.au at gmail.com> wrote in message
> news:itog87$2ed9$1 at digitalmars.com...
>> I'm working on a fix to
>> http://d.puremagic.com/issues/show_bug.cgi?id=6180
>>
>> Essentially the problem boils down to:
>>
>> - Module A has a private symbol named x
>> - Module B has a public symbol named x
>> - Module C imports A and B and tries to use x unqualified
>>
>> Should the fact that B.x is public and A.x is private disambiguate the
>> usage in module C to use B.x, or is that still an ambiguous unqualified
>> usage of variable x that requires manual qualification/disambiguation?
>
> If something's private, it's supposed to be an "internal-only" sort of
> thing. Private. Outside its own module, it shouldn't even be visibile and
> it's existence shouldn't have any effect. So I'd say unqualfied use of x
> inside C should definitely be allowed and resolve to B.x.
>
I'd add that IMO, to do otherwise would break encapsulation (or at least put
a big ugly dent in it).
More information about the Digitalmars-d
mailing list