ES6 doesn't need opt-in

Andreas Rossberg rossberg at
Mon Jan 2 06:07:04 PST 2012

It sure would be nice to put away with additional language modes. However:

Pragmatically, I don't see how wrapping your program into a module is
more convenient then putting a `use' directive on top. And your
additional proposal for "use module" is kind of admitting that it's
actually worse, isn't it? If I ever want to use `let' or `const' in my
main program (which I expect to be the common case for most users),
then I'm back to square one.

And technically, there is no actual difference between a scoped "mode"
and a dependence on syntactic context. The former is just a specific
way to provide the latter. Neither is simpler. (In fact, one could
argue that piggy-backing modules as a syntactic context for allowing
ES6-specific features is both limiting and conflating features.)

And of course, giving up on the top-level and proper static scoping is
a big price IMHO. Should we really do that so soon?

In other words, I think the main points of your proposal can
essentially be rephrased to:

1) Rename "use version 6" to "use module".
2) Allow module declarations in classic mode.
3) Make every module body start with an implicit "use module".
4) Keep the semantics of the top-level scope unaltered, even in
presence of a top-level "use module".

I'm fine with (1) to (3), but (4) seems to be a separate design choice.


More information about the es-discuss mailing list