On Sep 25, 2009, at 3:35 PM, Brendan Eich wrote:
Otherwise, what you're testing for is something like "is this code
currently running in strict mode" or "was this library loaded under
strict mode"?
Thanks for wiping up after me. :-)
David kindly pointed out that what I suggested originally is also
useful, and possibly it was what Charles wanted:
if (! function() { return this; }()) {
/* this if statement is in strict code */
}
is useful in its own right. The other test is also useful:
if (! function() { "use strict"; return this; }()) {
/* we're loaded in a browser supporting ES5 */
}
These are certainly idioms, especially the first test (as in "kick the
bucket", something an ES3 programmer could not understand based on the
terms in the code alone, only by also reading the ES5 spec or a book
based on it). Do they deserve sugar?
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss