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

ERROR: Module Collections not found in current path. #18989

Closed
juliohm opened this issue Oct 17, 2016 · 8 comments
Closed

ERROR: Module Collections not found in current path. #18989

juliohm opened this issue Oct 17, 2016 · 8 comments
Labels
error handling Handling of exceptions by Julia or the user

Comments

@juliohm
Copy link
Sponsor Contributor

juliohm commented Oct 17, 2016

In Julia v0.5 I can do:

Q = Collections.PriorityQueue()

but I cannot load the module:

using Collections

ERROR: ArgumentError: Module Collections not found in current path.
Run Pkg.add("Collections") to install the Collections package.
in require(::Symbol) at ./loading.jl:365

@yuyichao yuyichao added the error handling Handling of exceptions by Julia or the user label Oct 17, 2016
@yuyichao
Copy link
Contributor

I believe this is intentional. The error message could be better though.

@juliohm
Copy link
Sponsor Contributor Author

juliohm commented Oct 17, 2016

@yuyichao why is not good idea to allow the using Collections statement? Actually I wonder why these collections aren't part of Base, these data structures are at the core of many algorithms.

@yuyichao
Copy link
Contributor

why is not good idea to allow the using Collections statement?

Use using Base.Collections

Actually I wonder why these collections aren't part of Base, these data structures are at the core of many algorithms.

They are.

@juliohm
Copy link
Sponsor Contributor Author

juliohm commented Oct 17, 2016

Sorry, reformulating my question: why are they not rightly available like Array() or Dict()? I would say that PriorityQueue could be in the global namespace.

@fcard
Copy link
Contributor

fcard commented Oct 17, 2016

Well, using .Collections works also, could it check that

isdefined(current_module(), :AttemptedName) && isa(current_module().AttemptedName, Module)

and add using .AttemptedName to the suggestions if so?

@yuyichao
Copy link
Contributor

why are they not rightly available like Array() or Dict()? I would say that PriorityQueue could be in the global namespace.

Because we cannot put everything anyone ever find use full to be in global namespace. This might even be a good candidate to be moved out if it is not used in base.

@ararslan
Copy link
Member

This might even be a good candidate to be moved out if it is not used in base.

Ref #18497

@JeffBezanson
Copy link
Sponsor Member

using X always looks for X in the root namespace. We probably decided to do that so that name conflicts don't block loading a package entirely; they can only force you to add more qualifiers to names.

The other side of this is that Base exports Collections, which it arguably should not do. That might be changed with #5155.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
error handling Handling of exceptions by Julia or the user
Projects
None yet
Development

No branches or pull requests

5 participants