import.meta and TC39 process as a whole
dmitrii at dmitriid.com
Sat Aug 5 15:57:19 UTC 2017
Exactly! import.meta doesn’t make import an object. new.target doesn’t make new an object. function.sent doesn’t make function an object.
These are just purely arbitrary things tacked on top of randomly selected keywords because at one point someone needed some *introspection* info (such as “current execution context” etc.). Instead of designing a proper introspection API (or even the beginnings of it), we now have:
- keywords that are just keywords, really (typeof, case, break, etc.)
- keywords that are just keywords, but don’t even exist in a language. They are reserved for future use in various contexts: always reserved, only in strict mode, only in module code etc. (enum, public, private, await etc.). May never be used and may possibly be removed, as some keywords have been (int, byte, char etc.)
- literals that are basically keywords (null, true, false)
- non-keywords that are for all intents and purposes keywords (eval, arguments)
- keywords that look like objects (because they have additional properties) which are not objects (new with new.target)
- keywords that look like functions (because they are invoked like functions and return values like functions) which are not functions (import)
- keywords that look like objects *and* functions but are neither (import)
The last three are now the current fashionable trend in TC39 for some reason. Why?
On Sat, 05 Aug 2017 at 15:40 "T.J. Crowder"
On Sat, Aug 5, 2017 at 2:35 PM, Naveen Chawla <
mailto:naveen.chwl at gmail.com
> Thanks for the link! That means that `import` is already on the borderline of the spec since it wants to be a function and object.
No, not at all. It's a keyword. `import.meta` doesn't make `import` an object, any more than `new.target` makes `new` an object.
-- T.J. Crowder
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss