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

Keyword bikeshed #15

Open
mindplay-dk opened this issue Aug 15, 2020 · 6 comments
Open

Keyword bikeshed #15

mindplay-dk opened this issue Aug 15, 2020 · 6 comments

Comments

@mindplay-dk
Copy link

mindplay-dk commented Aug 15, 2020

  • import is a verb, asset is a noun - it doesn't sound like a directive, and they don't pair well.

  • The resulting symbol isn't the actual asset in the first place - only a reference to it.

  • Scripts (not just assets) could potentially be imported too, if for some reason you want to preprocess a script.

I suggest resolve as the keyword.

This will pair better with import, and more precisely explains how this will merely resolve the location of an asset, or any resource.

@stiff
Copy link

stiff commented Jan 23, 2021

ref or full reference may be better, because resolve is already used in Promises

@mindplay-dk
Copy link
Author

resolve is already used in Promises

Resolve is also used in require.resolve, so the terminology and meaning is well known and used in this domain already.

@mindplay-dk
Copy link
Author

The written spec actually uses the term resolve extensively.

image

@stiff
Copy link

stiff commented Jan 30, 2021

In the last example resolve is more in like Promise.resolve. Given a reference it resolves it (await's) to an asset itself.

If one would want to catch the loading exception then it should be written as
await resolve(Foo).catch(Bar)

or

await reference(Foo).catch(Bar)

?

@mindplay-dk
Copy link
Author

Well, importing an asset resolves the resource and returns a Promise which then resolves.

I can see why that's confusing.

Another verb that might work is link.

@shaedrich
Copy link

Yeah, resolve might be misleading as the resource is not entirely resolved as this is the whole point of it differing from the "normal" import statement, so resource, reference, defer would, however, resource, again, is a noun, which might not be the best choice here

It would be resolve if the "import" would result in a resolver function, which it doesn't:

asset { resolve } from "foo"

const Foo = await resolve();

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

No branches or pull requests

3 participants