On Sunday, June 16, 2013 11:06:18 Peter Alexander wrote: > On Saturday, 15 June 2013 at 23:36:35 UTC, Walter Bright wrote: > > On 6/15/2013 2:34 PM, Timon Gehr wrote: > >> It sure is, the module system is supposed to provide hijacking > >> protection. > > > > Inner scopes override outer scopes. That isn't what hijacking > > is. > > I think this is an issue Walter, consider: > > void main() > { > import std.stdio; > string message = "Hello, world!"; > writeln(message); > } > > It std.stdio contains a symbol called "message" then this will > not print "Hello, world". Updates to libraries that introduce > symbols could subtly break working code. > > Whether or not this is what hijacking is, I think this is a > problem.
I concur. It may be that it's reasonable for local imports to shadow declarations from outside the function rather than creating conflicts, but they definitely shouldn't shadow symbols inside the function - _especially_ when the local symbol is declared after the local import. The current behavior is just going to create bugs. - Jonathan M Davis