But we can hear feedback, esp. on this list, about hardship adopting
strict mode in early ES5 implementations. Mozilla's will be done
shortly, and it sounds like WebKit's is coming along quickly too.
Feedback based on two interoperable implementations in developers'
hands before the ES5 spec is stamped done would have been best. But
real-code/real-world feedback better late than never is welcome.
Once an implementation is out to play with you can be sure I will try
to build SproutCore with ES5 in strict mode and report back!
But just to be clear, after all of the discussion here, it appears
that the only way to implement a "call super" pattern in ES5 (without
resorting to closures as Breton suggested) would be to use the
following magic phrase everywhere I want to invoke super:
var IS_ES5_STRICT = /** detect ES5 strict mode somehow */
ClassB = ClassA.extend({
foo: function method() {
(IS_ES5_STRICT ? method : arguments.callee).base.apply(this,
arguments);
}
});
Keep in mind that since I need to know the current function instance,
I can't abstract this code into a function. Everyone will just have
to know this magic phrase to "call super".
The SproutCore build tools already have a special symbol called
sc_super() that we can replace with the above code so I guess its not
a deal killer for me but still, thinking on behalf of casual JS coders
with no build tools, this seems not so great.
Or perhaps you would say that this kind of conditional code is what
you expect developers to write when they try to create JS that is
backward compatible with older JavaScript/JScript engines and ES5.
-Charles
PS. Is there an official way to detect that I am running code in ES5
strict mode? I can't find it in the spec.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss