Last active
July 21, 2017 17:18
-
-
Save mppf/9572f0eb703134ae0f39bdaa4367e760 to your computer and use it in GitHub Desktop.
showing bug with implicit module and same name inner module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc bar() { | |
writeln("in bar"); | |
} | |
module Bug { | |
proc foo() { | |
writeln("in foo"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Bug; | |
foo(); | |
bar(); |
We can go deeper:
var topVar = 13;
module Bug {
var inner = 7;
module Bug {
var innerinner = 3;
}
}
Can be accessed via:
use Bug.Bug.Bug;
writeln(innerinner);
or
use Bug;
use Bug;
use Bug;
writeln(innerinner);
Technically, it's not a naming conflict, but it is confusing. I'm tempted to make it a warning instead of an error
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It works if User uses Bug twice