import.meta and TC39 process as a whole
Naveen Chawla
naveen.chwl at gmail.com
Sat Aug 5 12:46:28 UTC 2017
I think it has to be an identifier, especially given proposals like `meta`,
dynamic functionality etc. The question for me is whether it's `import` or
`module`. Suppose it's `import`: already proposed to act as a per-module
function (`import()`) with a property (`import.meta`) are we trying to
prevent things like:
`import.myModuleVar = 5` and `console.log('Import is '+import);` ?
Passing it around seems fine to me. What if you want to aggregate your
modules into a list and see what's going on?
I see `import` or `module` as analogous to `window` but per-module.
I'd like to hear why passing `import` or `module` around should be
expressly disallowed.
Both `import` and `module` alternatives are backwards-compatible /
existing-code friendly as an identifier, by allowing masking and/or
reassignment with no effect. For me the question is which offers better
clarity and less confusion.
I'd love to be corrected if wrong
On Sat, 5 Aug 2017 at 16:38 T.J. Crowder <tj.crowder at farsightsoftware.com>
wrote:
> On Sat, Aug 5, 2017 at 11:58 AM, Naveen Chawla
> <naveen.chwl at gmail.com> wrote:
> >
> > How is `document` and `window` handled when someone does
> > `const document =` ?
>
> At global scope in a script body, in a browser context, it's an error,
> as you presumably know, because `document` is already declared.
>
> > It would seem perfectly fine to allow `module` to be masked by
> > other variables, and if someone wants to use the module-global
> > `module`, they can just rename in order to get access.
>
> Yes. That's what I said.
>
> The issue with it being an identifier isn't shadowing. It's that then
> it's a binding with a value, and that value can be passed around,
> which I suspect isn't okay.
>
> For clarity: To get `module`, either:
>
> 1. It's a context-sensitive keyword, and code that's using it needs to
> be updated when migrated to a module.
>
> 2. It's an identifier, which means its value can be passed around.
>
> All I've said, again, is: I *suspect* that having it be an identifier
> is a non-starter. But perhaps you can get support for a
> context-sensitive keyword, if people feel it's worth the complexity
> for mildly-improved semantics.
>
> -- T.J. Crowder
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20170805/20d1d1cf/attachment.html>
More information about the es-discuss
mailing list