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

Explainer based on single string following as #36

Merged
merged 2 commits into from
Feb 3, 2020
Merged

Conversation

littledan
Copy link
Member

Proposing switching to a single string, following the reasoning in #12 (comment)

cc @xtuc @dandclark @MylesBorins

README.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
Copy link
Collaborator

@dandclark dandclark left a 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")
Copy link
Member

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" })?

Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member

@xtuc xtuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

Copy link
Member

@MylesBorins MylesBorins left a 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")
Copy link
Member

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

@MylesBorins MylesBorins merged commit 185ca9c into master Feb 3, 2020
@MylesBorins MylesBorins deleted the as-explainer branch February 3, 2020 19:30
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

Successfully merging this pull request may close these issues.

4 participants