Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArgumentError while importing from a module alias #25970

Closed
tkoolen opened this issue Feb 9, 2018 · 3 comments
Closed

ArgumentError while importing from a module alias #25970

tkoolen opened this issue Feb 9, 2018 · 3 comments
Labels

Comments

@tkoolen
Copy link
Contributor

tkoolen commented Feb 9, 2018

On 0.6.2:

julia> const It = Base.Iterators
Base.Iterators

julia> import It: product # fine

but

julia> module M
       const It = Base.Iterators
       import It: product
       end
ERROR: ArgumentError: Module It not found in current path.
Run `Pkg.add("It")` to install the It package.

On 9-day old master (0f95988), both result in the ArgumentError. I would expect both to work.

@tkoolen tkoolen changed the title Import with module alias ArgumentError while importing from a module alias Feb 9, 2018
@JeffBezanson
Copy link
Member

The new behavior is correct. In import X, X is not evaluated in the current lexical scope, but rather names a top-level package to be found in the load path (and using other package management mechanisms). Previously Main was special, in that it was effectively used to cache loaded packages. See #17997.

@JeffBezanson
Copy link
Member

To look in the current namespace, use import .It.

@tkoolen
Copy link
Contributor Author

tkoolen commented Feb 9, 2018

OK, thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants