on caller descriptor

Andrea Giammarchi andrea.giammarchi at gmail.com
Sun Apr 14 00:53:48 PDT 2013


I wonder if all of this is expected:

(function(){
  "use strict";
  function caller() {
    alert(caller.caller);
  }
  // error if invoked: caller();
  // but showing up in properties
  var properties = Object.getOwnPropertyNames(caller);
  if (properties.indexOf('caller')) {
    console.log(JSON.stringify(
      Object.getOwnPropertyDescriptor(caller, 'caller')
    ));
    // will show
    // enumerable: false, configurable: false
  }
}());

same is for arguments ... so fn.arguments is there too

Am I the only one thinking this is confusing ?

I understand it's convenient for engines to simply put such descriptor
there but shouldn't these properties be hidden under use strict?

Just wondering, thanks for any clarification.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130414/c3a33dfd/attachment.html>


More information about the es-discuss mailing list