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

RFC: Remove glob-import functionality completely #305

Closed
rust-highfive opened this issue Sep 24, 2014 · 4 comments
Closed

RFC: Remove glob-import functionality completely #305

rust-highfive opened this issue Sep 24, 2014 · 4 comments

Comments

@rust-highfive
Copy link

Issue by Aatch
Sunday Jan 26, 2014 at 22:47 GMT

For earlier discussion, see rust-lang/rust#11825

This issue was labelled with: B-RFC in the Rust repository


Glob import statements are a frequent cause of confusion and bugs in Rust code. They currently exist behind a feature gate, so there is already some pressure against them.

I suggest removing them completely. The only thing I can think of that would be a significant issue about removing the glob functionality would be how it affects the prelude. However, we could just special case prelude functionality.

The advantage of this is that would make the resolution algorithm much simpler, since the glob import functionality adds significant complexity.

cc @pcwalton

@ketsuban
Copy link
Contributor

I suggest allowing module writers to define a list of names which a glob-import would pull into the target namespace, and emit an error if the module is glob-imported but does not define one. The model here is the __all__ magic in Python, which tends to be underused entirely because Python otherwise defaults to importing everything defined in the module namespace.

The main use case for glob-importing seems to be easing the fingers of the user when following good practice in breaking their code into multiple crates; this covers that without the unfortunate consequences in every other situation which lead people to call for eliminating glob-imports entirely.

@steveklabnik
Copy link
Member

Glob imports are now stable, and so I'm going to give this a close.

@Kimundi
Copy link
Member

Kimundi commented Jan 27, 2015

But not bug free, sadly :P

@steveklabnik
Copy link
Member

What software is? Anyway, bugs should certainly be filed in rust-lang/rust

withoutboats pushed a commit to withoutboats/rfcs that referenced this issue Jan 15, 2017
Fix a race in Shared where it blocks forever
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants