Effective D book?

David Nadlinger code at klickverbot.at
Sat Jun 15 15:11:18 PDT 2013


On Saturday, 15 June 2013 at 21:35:20 UTC, Timon Gehr wrote:
> On 06/15/2013 05:09 PM, Peter Alexander wrote:
>> On Saturday, 15 June 2013 at 12:20:46 UTC, Timon Gehr wrote:
>>> One issue with local imports is that they hide local symbols.
>>
>> Can you give an example? I can't repro.
>>
>> void main()
>> {
>>     import std.stdio;
>>     void writeln(string) {}
>>     writeln("foo");
>>     std.stdio.writeln("bar");
>> }
>>
>> This writes only "bar".
>
> More peculiar example:
>
> void main(){
>     import std.stdio;
>     void writefx(string s){writeln(s);}
>     {
>         import std.stdio;
>         writefx("bar"); // error: writefx is private
>     }
> }
>
> 'writefx' happens to be a private symbol in std.stdio.

You might want to open a bug report for this.

David


More information about the Digitalmars-d mailing list