On Tue, Jan 3, 2012 at 4:08 PM, Brendan Eich <bren...@mozilla.com> wrote:

> On Jan 3, 2012, at 1:24 PM, Mark S. Miller wrote:
>
> >                            Just Two Modes
>
> V8 folks the other year had a catchier version: "no more modes".
>

I am happy with that ;).



>
>
> > * ES6 non-strict mode must be practically upwards compatible from ES5
> non-strict mode.
>
> This is the part that's not clearly agreed to, or perhaps not even clearly
> proposed yet.
>
> Dave alluded to how we can decide on a case-by-case basis how new syntax
> using already-reserved (since ES1) keywords could be meaningful in <script>
> (no version) if the engine supports ES6 (or ES7, later, etc.).
>
> For example, class.


A good example. Since the class proposal uses  "private, public, static",
by these principles, it would only be recognized in strict mode. If it
appears in non-strict code, it would be a SyntaxError.



> *If* we support class in ES6, why shouldn't it be usable at top level not
> in a module (via module{...} or |use module;|)? The syntax is a guaranteed
> error in downrev engines.
>

It would be, so long as that code is strict. Just say "use strict"; outside
a module and you can use classes.



>
> Same for destructuring, rest/spread, etc. as I've mentioned in recent
> messages.
>

"let" would only be allowed in strict code. ES5 non-strict allows "let" to
be used as a variable name, so ES6 non-strict should too.

Want to use "let" scoping outside a module? Again, just say "use strict";.

What remaining issues are there in using destructuring, spread, or rest in
non-strict code? The short answer, not knowing what conflicts you have
identified, is that if it is painless and backward-compatible (see below)
to accept these in both strict and non-strict, then we should. Otherwise,
we accept these only in strict code.



>
> Why you write "upwards compatible" you may mean something other than
> what's defined at
>
> http://en.wikipedia.org/wiki/Forward_compatibility
>
> viz, new code degrades gracefully on old engines. If you mean that old
> code runs in new engines without changed semantics, that is downward or
> backward compatibility. I'm not sure what you meant so I'll stop here.


I mean that "old code runs in new engines without [practically] changed
semantics". Sorry for the confusion.

I insert [practically] above to cover cases like completion reform.
Although it is not formally backward compat, if it doesn't break any real
programs besides test262 tests, we should go for it and arrange to forgive
ES5 engines that implement it.

-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to