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

Feature request: Selective imports #212

Closed
gopherbot opened this issue Nov 15, 2009 · 4 comments
Closed

Feature request: Selective imports #212

gopherbot opened this issue Nov 15, 2009 · 4 comments

Comments

@gopherbot
Copy link

by kirklin.mcdonald:

It would be nice to be able to cherry-pick symbols from a package to use by 
their unqualified names. To steal the syntax used by D for this purpose, we 
would have:

import "fmt" : Printf

With this, Printf would become a name within the file's namespace referring 
to fmt.Printf. The import would not insert any other names into the file's 
namespace (not even fmt).
@gopherbot
Copy link
Author

Comment 1 by kirklin.mcdonald:

I should add that the thing after the colon would be a comma-separated list of 
identifiers, as in:
import "fmt" : Printf, Println, Sprintf

@rsc
Copy link
Contributor

rsc commented Nov 16, 2009

Comment 2:

Labels changed: added language-change.

Status changed to Thinking.

@rsc
Copy link
Contributor

rsc commented Nov 17, 2009

Comment 3:

It's worth noting that this breaks the assumptions laid out in
http://golang.org/doc/effective_go.html#Names
For example, once.Do is a good name; Do is not.

@robpike
Copy link
Contributor

robpike commented Nov 21, 2009

Comment 4:

Status changed to WontFix.

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants