-
Notifications
You must be signed in to change notification settings - Fork 0
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
Clarification on import name alias #3
Comments
Right. The only "automatic" alias you can get is the one for "unpacking" single items from an import that uses a namespace that the imports are otherwise mapped into:
➔
For any other alias, you need to add your own rule
We could add syntax to allow creating these, or we could let the spec writer simply write that additional rule. |
Since adding the alias yourself is that easy, I would rather not complicate the syntax further for this. On the contrary, I would actually reconsider having the "automatic" alias as well, with the same argument. Getting rid of the automatic alias would also allow for simplified syntax for namespaced includes/imports as in:
instead of repeating the namespace name verbally for every rule:
That way, the only difference between including/importing a module with or without namespacing is the As mentioned above, the different semantics for include/import, with/without explicit rule selection and with/without namespaces got me slightly confused and I think dropping the automatic alias feature and unifying explicit rule selection would ease understanding. Or is there any good reason why this kind of automatic alias creation is especially useful / used that much that it justifies the added complexity? |
The reason I proposed it this way was:
(1) You usually want to use the alias, so this is a labor-saving device (less added typing when you don’t need the alias and would get it without adding `cose.` than when you need it and wouldn’t get is without adding `label = cose.label` on a line of its own
(2) In this way, there is a uniformity that everything between `import` and `from` are going to be names are actually are added to the importing module.
Grüße, Carsten
|
Section 2.6 states that
giving the following example
First of all, I would suggest changing the
mydata
definition to actually use that alias instead of the namespaced version.But it is also not completely clear to me how this alias definition is supposed to work - does it barely mean that for a given name, an additional rule is added without namespace (and the name needs to match the name in the imported module)? If so, the wording is a bit confusing to me.
Reading the sentence above, I would have expected syntax along the lines of
which would define
my_map
(without namespace) as an alias forcose.empty_or_serialized_map
.The text was updated successfully, but these errors were encountered: