Skip to content

Instantly share code, notes, and snippets.

@mppf
Last active July 21, 2017 17:18
Show Gist options
  • Save mppf/9572f0eb703134ae0f39bdaa4367e760 to your computer and use it in GitHub Desktop.
Save mppf/9572f0eb703134ae0f39bdaa4367e760 to your computer and use it in GitHub Desktop.
showing bug with implicit module and same name inner module
proc bar() {
writeln("in bar");
}
module Bug {
proc foo() {
writeln("in foo");
}
}
use Bug;
foo();
bar();
@mppf
Copy link
Author

mppf commented Jul 21, 2017

It works if User uses Bug twice

@lydia-duncan
Copy link

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