-
Notifications
You must be signed in to change notification settings - Fork 26
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
Explainer based on single string following as
#36
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a couple suggestions
|
||
```js | ||
import("foo.json", { type: "json" }) | ||
import("foo.json", "json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to be consitent with the ImportDeclaration syntax, allowing both a string and an object (in the future), but It doesn't look as descriptive to me.
what about using the same semantics than the worker instantion, import("foo.json", { as: "json" })
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are there other parameters we might want to send to import()
that would not make sense as module attributes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, my only argument is that it doesn't look as obvious as an ObjectLiteral with an as
key, but I don't feel very strong about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I agree that the placement-based syntax isn't so obvious. But, I think if we add object attributes later, it will be weird to have to put them nested inside this {as:}
construct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @littledan's take here. If we want to use the object form I think we should be consistent with the name of the field rather than as
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
||
```js | ||
import("foo.json", { type: "json" }) | ||
import("foo.json", "json") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @littledan's take here. If we want to use the object form I think we should be consistent with the name of the field rather than as
Proposing switching to a single string, following the reasoning in #12 (comment)
cc @xtuc @dandclark @MylesBorins