-
Notifications
You must be signed in to change notification settings - Fork 3
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
Shorthand for same-named "as" clause #4
Comments
Another option: import *foo;
import foo.*bar; |
yet another option: import *foo*;
import foo.*bar*; |
I wonder if the import foo; // `foo` prefix
import *foo; // "wildcard" import, no prefix. |
All of those look awfully "punctuation-ey" to me. How about one of: import foo.bar as;
import as foo.bar; Either way, I think it might be better to consider this a separate proposal. I think it's easier to us to adopt small bits of sugar at a time, instead of large doses. |
Normally I prefer keywords too, but in this case the punctuation accentuates that the identifier is being used both to quality the location of the library as well as specify the prefix.
It could work for traditional imports too:
but it reads like an unfinished / incomplete sentence to me.
looks like the prefix is |
Same here. Yet another variation, use parenthesis with 'as': import (as foo).bar;
import foo.(as bar);
I agree, let's keep this as something separate. |
It's quite common to import a library using the same prefix as the last segment of the library's name. It would be nice to have a shorthand for doing this:
as shorthand for:
Alternative syntaxes:
(too similar to a function call?)
(too similar to destructuring?)
The text was updated successfully, but these errors were encountered: