Error or a new behaviour with 2.071.0

Vladimir Panteleev via Digitalmars-d digitalmars-d at puremagic.com
Fri Apr 8 06:35:26 PDT 2016


On Friday, 8 April 2016 at 13:31:38 UTC, Dicebot wrote:
> On Friday, 8 April 2016 at 13:28:15 UTC, Daniel Kozak wrote:
>> From https://dlang.org/spec/attribute.html#ProtectionAttribute
>>
>> Protection does not participate in name lookup. In particular, 
>> if two symbols with the same name are in scope, and that name 
>> is used unqualified then the lookup will be ambiguous, even if 
>> one of the symbols is inaccessible due to protection. For 
>> example:
>>
>> module A;
>> private class Foo {}
>> module B;
>> public class Foo {}
>> import A;
>> import B;
>>
>> Foo f1; // error, could be either A.Foo or B.Foo
>> B.Foo f2; // ok
>>
>>
>> But Foo f1; // works ok now with 2.071.0
>
> The spec needs to be changed here (it was describing behaviour 
> that was a long-standing bug).

Yep. The previous behavior was bad because adding private symbols 
to a module should not break programs that import that module.



More information about the Digitalmars-d mailing list