arguments.callee in Harmony

David Flanagan david at davidflanagan.com
Fri Sep 25 15:22:48 PDT 2009


Charles Jolley wrote:
> Has anyone considered providing a more explicit way of testing for 
> this?  Maybe a constant that is defined somewhere.  

Strict mode isn't a global on-or-off thing. Some functions can be strict 
while others aren't.  So you can't capture it in a constant.

Anyway, that's what
> I'm going to do:
> 
> SC.HAS_STRICT = !(function() { return this;}());
> 
> :)

If you're testing "does this browser support strict mode" then you'd 
better test it in an explicitly strict context:

SC.HAS_STRICT = (function() {
   "use strict";
    return !(function() { return this; }());
}());

(Or something like that.  I sure will be happy when there's an 
implementation to test this stuff against.)

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"?

	David Flanagan


More information about the es-discuss mailing list