[Issue 10378] Prevent local imports from hiding local symbols

2019-07-13 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #39 from Dlang Bot  ---
dlang/dmd pull request #10167 "Fixup date for removing check10378/bug10378
globals" was merged into master:

- 6da24d438a6b75ed0db8eb1a8b1f1b63318f19a6 by Geod24:
  Fixup date for removing check10378/bug10378 globals

  Introduced by 625c75a1b3.

https://github.com/dlang/dmd/pull/10167

--


[Issue 10378] Prevent local imports from hiding local symbols

2018-12-09 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

Mike Franklin  changed:

   What|Removed |Added

   See Also||https://issues.dlang.org/sh
   ||ow_bug.cgi?id=19471

--


[Issue 10378] Prevent local imports from hiding local symbols

2017-08-02 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #38 from github-bugzi...@puremagic.com ---
Commit pushed to dmd-cxx at https://github.com/dlang/dmd

https://github.com/dlang/dmd/commit/e08bd01d142b0387d2d112a60503495f72f933ef
Issue 10378 - Local imports hide local symbols

--


[Issue 10378] Prevent local imports from hiding local symbols

2017-07-03 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

Vladimir Panteleev  changed:

   What|Removed |Added

 CC||timothee.co...@gmail.com

--- Comment #37 from Vladimir Panteleev  ---
*** Issue 15819 has been marked as a duplicate of this issue. ***

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-06-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

Sobirari Muhomori  changed:

   What|Removed |Added

 CC||c...@dawg.eu

--- Comment #36 from Sobirari Muhomori  ---
*** Issue 12279 has been marked as a duplicate of this issue. ***

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #35 from timon.g...@gmx.ch ---
(In reply to Steven Schveighoffer from comment #34)
> What I mean is, really Timon's code should be:
> 
> string readAndLog(string filename){
> import std.file : readText;
> auto text=readText(filename);
> write(filename," read successfully!\n");
> return text;
> }
> 
> i.e. only use scoped imports with a qualified list of which symbols you will
> use, or use a renamed import.
> 
> This prevents any hijacking.

Well, there's an arbitrary number of conventions that will prevent any
hijacking.
The point of my example was to expose a remaining flaw in the new import lookup
design.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #34 from Steven Schveighoffer  ---
What I mean is, really Timon's code should be:

string readAndLog(string filename){
import std.file : readText;
auto text=readText(filename);
write(filename," read successfully!\n");
return text;
}

i.e. only use scoped imports with a qualified list of which symbols you will
use, or use a renamed import.

This prevents any hijacking.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #33 from hst...@quickfur.ath.cx ---
There has been a steady stream of PRs, at least when I was active last year,
that moved imports into local scope (to keep Phobos internal interdependencies
under control) and turned local imports into scoped imports (to prevent
hijacking).  If you find any other places in Phobos that has
possibly-hijackable local imports, please file a bug or submit a PR. :-)

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #32 from Steven Schveighoffer  ---
(In reply to hsteoh from comment #31)
> So unqualified local imports are still extremely dangerous... :-(

I think we should point out wherever the docs are that say how local imports
work that best practice is to use selective or renamed imports as local imports
to avoid issues.

And then fix Phobos/Druntime to follow those recommendations :)

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #31 from hst...@quickfur.ath.cx ---
Ouch. That's a pretty nasty one. I suppose it's because the inner import pulls
in 'write' into a different overload set from the outer import, so the compiler
doesn't complain about the ambiguity error, even though the user did not intend
to call std.file.write (rather than std.stdio.write) here.

So unqualified local imports are still extremely dangerous... :-(

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #30 from timon.g...@gmx.ch ---
(In reply to hsteoh from comment #29)
> Do you have an example where this is problematic?
> 

Slightly contrived, but here you go:

import std.stdio;

string readAndLog(string filename){
import std.file;
auto text=readText(filename);
write(filename," read successfully!\n");
return text;
}

void main(){
writeln(readAndLog("important_data.txt"));
}


> At any rate, it's better than the stonewall silence we've had on import
> issues for many years now.

I agree. This is way better than what we had before. If a fix for hijacking is
implemented, I would personally prefer to pick a proposed solution that
actually fixes the hijacking problems.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #29 from hst...@quickfur.ath.cx ---
Do you have an example where this is problematic?

At any rate, it's better than the stonewall silence we've had on import issues
for many years now.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #28 from timon.g...@gmx.ch ---
(In reply to hsteoh from comment #25)
> Woohoo! Finally this bug is fixed! Big thanks to Walter for doing this.
> 

It's probably not the best fix though. Now locally imported symbols can still
hide symbols imported in a less deeply nested scope, hence hijacking is still
not prevented. This can also be dangerous when refactoring a large module into
smaller ones.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #27 from hst...@quickfur.ath.cx ---
In the discussion on the PR for this bug, #313 and #314 were mentioned as
primary candidates to be fixed in the next compiler release. I think it makes
sense to fix these module-related bugs as the goal for this release, since some
of them will be breaking changes, and it's better to break module-related stuff
once and have it work correctly from then on, than to be forced to break code
multiple times -- users would revolt.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #26 from Ketmar Dark  ---
but they are... long time ago:
https://github.com/D-Programming-Language/dmd/pull/3416

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-17 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #25 from hst...@quickfur.ath.cx ---
Woohoo! Finally this bug is fixed! Big thanks to Walter for doing this.

Now looking forward to the fixes for issues #313 and #314 as well...

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-16 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #24 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/e5be0735919ce89dca7488e72229823d4a221773
fix Issue 10378 - Local imports hide local symbols

https://github.com/D-Programming-Language/dmd/commit/57592cf2c52460d8d5dfc74e5c02d6afb7bc6c33
Merge pull request #5445 from WalterBright/fix10378-2

fix Issue 10378 - Local imports hide local symbols

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #23 from Walter Bright  ---
Since this was working as designed, I reclassified it as an enhancement
request.

--


[Issue 10378] Prevent local imports from hiding local symbols

2016-02-13 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=10378

Walter Bright  changed:

   What|Removed |Added

Summary|Local imports hide local|Prevent local imports from
   |symbols |hiding local symbols
   Severity|critical|enhancement

--