tc39/proposal-asset-references

Keyword bikeshed

Opened this issue · 5 comments

  • 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 commented

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

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.

The written spec actually uses the term resolve extensively.

image

stiff commented

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)

?

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.