Nested public imports - bug or feature?
Dmitry Olshansky via Digitalmars-d
digitalmars-d at puremagic.com
Thu Aug 13 07:25:15 PDT 2015
On 13-Aug-2015 16:56, Timon Gehr wrote:
[snip]
> It has nothing to do with the import being public. This works:
>
> ---
> struct Std{
> import std.stdio;
> }
> void main(){
> Std.writeln("Nice!");
> }
> ---
>
> (It also works if main and Std are defined in different modules.)
>
>> but I also don't see how this could work any other way
>> if scoped, public imports are allowed.
>> ...
>
> Easy. Just treat aggregate scopes and module scopes differently. (They
> are treated differently even now: all imports are 'public' in aggregate
> scopes, but not at module scope.) I think this shouldn't be done though.
>
> In any case, I guess we agree that this idiom should work for public
> imports, but not for non-public ones (so the current behaviour with
> non-public imports is accepts-invalid, but Dicebot's code should be fine)?
Agreed, public import case looks legitimate.
--
Dmitry Olshansky
More information about the Digitalmars-d
mailing list