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.
ref
or full reference
may be better, because resolve is already used in Promise
s
resolve is already used in
Promise
s
Resolve is also used in require.resolve
, so the terminology and meaning is well known and used in this domain already.
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
.