Make things like Reflect an import instead of a global?
Jordan Harband
ljharb at gmail.com
Wed Aug 17 04:49:45 UTC 2016
We don't yet have a mechanism for built-in modules, and that's not going to
be an obstacle for continuing to improve the language.
As soon as a viable mechanism and precedent exists for that, new things
very well might only be added via that mechanism, rather than solely by
adding new global things.
On Tue, Aug 16, 2016 at 6:52 PM, /#!/JoePea <joe at trusktr.io> wrote:
> Seems like when the ES6 Modules became official that it would be a good
> idea to *not* define more globals in the language, and instead spec things
> to be modules, f.e. something like:
>
> ```js
> import {apply} from 'Reflect'
> // insead of
> const {apply} = window.Reflect
> ```
>
> This would also be a pattern for programs that use the JS engine to follow:
>
> ```js
> import {define} from 'CustomElements' // in browsers
> // instead of
> const {define} = window.customElements
> ```
>
> Maybe a symbol would be needed for any modules that are native?
>
> ```js
> import {define} from '#CustomElements' // # means native module
> ```
>
> */#!/*JoePea
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160816/7afa19c2/attachment.html>
More information about the es-discuss
mailing list