Brendan Eich wrote:
Mark S. Miller wrote:
Class is an interesting case though, for three reasons.
1) Its body is not a function body, and so it would be yet more syntax
to enable a class to opt into strict mode explicitly.
Right. I don't think we've considered this carefully in TC39 yet.
2) It is a large-grain abstraction mechanism, much like modules, and
often used as the only module-like mechanism in many existing
programming languages. (Yes, JavaScript is a different language. But
we called it "class" to leverage some of that prior knowledge.)
Won't quibble ;-).
3) It looks as foreign to old ES3 programmers as does module.
More positive: it looks like a unit of new and stricter code, so it
could be strict by fiat, implicitly.
So I recommend no implicit opt-in, except for module (of course) and
possibly class. If class does not implicitly opt in, we need to extend
the class body syntax to accept a "use strict" pragma.
Good, happy to have support for class bodies implicitly strict!
I would like it as well.
/be
Herby
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss