2.068.0 regression?
Timon Gehr via Digitalmars-d
digitalmars-d at puremagic.com
Wed Aug 19 16:29:25 PDT 2015
On 08/20/2015 01:20 AM, deadalnix wrote:
> On Wednesday, 19 August 2015 at 23:18:04 UTC, Timon Gehr wrote:
>> On 08/20/2015 01:06 AM, Dicebot wrote:
>>> On Wednesday, 19 August 2015 at 22:33:23 UTC, Timon Gehr wrote:
>>>> It's a bug in local imports. This is the ticket:
>>>> https://issues.dlang.org/show_bug.cgi?id=10378
>>>
>>> Seems to fit into existing shadowing semantics.
>>
>> There's no precedent for symbols shadowed by imports.
>>
>>> If this is a bug we may need a new spec.
>>
>> I believe local imports were first implemented without paying any
>> attention to shadowing. I think the broken semantics implemented in
>> DMD without a sufficient up-front design were then back-ported into
>> the documentation at some point. This still happens too often. This is
>> the JavaScript style of language design.
>
> import should NEVER shadow local symbols.
And yet for some reason this obviously broken behaviour is now
documented as intended in the official language documentation.
http://dlang.org/module.html, look for "Scoped Imports".
"The imports are looked up to satisfy any unresolved symbols at that
scope. Imported symbols may hide symbols from outer scopes."
On that same page:
"Modules offer several guarantees:
[...]
● If a module C imports modules A and B, any modifications to B
will not silently change code in C that is dependent on A."
More information about the Digitalmars-d
mailing list