7

Possible Duplicate:
Why was the arguments.callee.caller property deprecated in JavaScript?

In ES5 strict mode (i.e. "use strict") the arguments.callee variable that refers to the current function is no longer available.

For recursive functions it's obviously sensible to use the function's own name. However there are times when I might want to use properties of arguments.callee (i.e. .length, .prototype) without having to use the name of the current function.

Can anyone explain what apparent problem was (allegedly) solved by removing it?

Community
  • 1
  • 1
Alnitak
  • 334,560
  • 70
  • 407
  • 495
  • Bad practice, pretty much. All cases of `arguments.callee` either can be solved in a more elegant manner, or should not be solved. – Ry- Aug 31 '12 at 14:59
  • 1
    Related: http://stackoverflow.com/questions/103598/why-was-the-arguments-callee-caller-property-deprecated-in-javascript. – Frédéric Hamidi Aug 31 '12 at 15:04
  • As for the edge cases: that's part of why I don't use strict mode anymore... :P – Ry- Aug 31 '12 at 15:09
  • 1
    @ close voters - that question is about a specific sub-property of `arguments.callee`. – Alnitak Aug 31 '12 at 15:13
  • 1
    @Alnitak: The answer "accidentally" is for a big part about `.callee`. – pimvdb Aug 31 '12 at 15:14

1 Answers1

5

From here.

arguments.callee substantially hinders optimizations like inlining functions, because it must be made possible to provide a reference to the un-inlined function if arguments.callee is accessed.

xdazz
  • 158,678
  • 38
  • 247
  • 274
  • Do you happen to know why the reference is not required in case of a named function? – pimvdb Aug 31 '12 at 15:21
  • @pimvdb Because the name of the function is always made available in the local scope of the function itself. – xdazz Aug 31 '12 at 15:33
  • I'm as curious as @pimvdb is; but I don't see how you've answered his question. If you can provide a reference to the un-inlined version of the function via `return `, then that's no different from doing so via `return arguments.callee`. Is it? If so, how? – ELLIOTTCABLE Nov 18 '12 at 17:19