On Fri, Sep 12, 2008 at 9:05 PM, Erik Arvidsson <[EMAIL PROTECTED]> wrote: > Inside Google we have a few occurrences of arguments.callee. Some of > these are from Prototype, MochiKit, jQuery and other third party code. > > I agree with Tobie regarding the 2 use cases but there is one more > related use case and that is arguments.callee.caller and I know a lot > of developers here rely on and that to be able to generate a stack > trace. This is crucial for fixing bugs in production systems. > SpiderMonkey has the Error.prototype.stack property and if that was > supported everywhere I don't think there would be any serious > complaints about removing arguments.callee and > arguments.callee.caller. > >
+1 for error stack. (it's actually an instance property generated dynamically, 'stack'in Error.prototype) Garrett > On Sat, Sep 13, 2008 at 08:19, Bob Ippolito <[EMAIL PROTECTED]> wrote: >> I found it convenient when writing MochiKit for the same reasons that >> it's in Prototype but it would be rather simple to change things >> around to use named references to functions or whatever else was >> appropriate. It occurs 28 times in trunk. >> >> -bob >> >> On Fri, Sep 12, 2008 at 5:08 PM, Brendan Eich <[EMAIL PROTECTED]> wrote: >>> Great -- good to have library authors / maintainers on this list. >>> >>> I hold no brief for callee. The only issue in its favor is the cost of >>> migrating to strict mode. A new version of Prototype that loses >>> internal arguments.callee uses and is otherwise compatible helps. >>> >>> Dojo and other Ajax folks on the list, please pipe up. >>> >>> / be >>> >>> Sent from my iPhone >>> >>> On Sep 12, 2008, at 6:54 PM, Tobie Langel <[EMAIL PROTECTED]> >>> wrote: >>> >>>> >>>> On Sep 11, 2008, at 14:34 , Brendan Eich wrote: >>>> >>>>> I snipped your words about callee, but it's used quite a bit in Ajax >>>>> libraries, e.g, Prototype: >>>>> >>>>> $ grep -w callee prottype.js >>>>> replacement = arguments.callee.prepareReplacement(replacement); >>>>> var self = arguments.callee; >>>>> parts.add = arguments.callee.addPair; >>>>> >>>>> (Prototype 1.5.1.1.) >>>> >>>> In Prototype, arguments.callee is used in two distinct cases: >>>> >>>> 1) reading a property of the callee, and >>>> 2) recursively calling the callee. >>>> >>>> Case #1 is easily solved by storing the said property in a closure, >>>> or by setting it elsewhere (where it probably would be a better fit, >>>> anyway). >>>> >>>> Case #2 is easily solved by using a named function instead. For the >>>> particular case where it is used in Prototype, the anonymous >>>> function lies inside of a closure, so there is no chance of >>>> triggering the JScript scope bug nor of polluting the global >>>> namespace when naming it. >>>> >>>> From what I understand, ES 3.1 strict mode compliance will be opt-in >>>> and will require at least slight source code modifications (if only >>>> to prepend it with the 'use strict'; expression). So current >>>> versions of Prototype (or other libs, for that matter), will not be >>>> ES 3.1 'strict' compliant by default. >>>> >>>> I'm not really worried about modifying Prototype to avoid use of the >>>> arguments.callee property. As a matter of fact, we've already done >>>> so in a development branch for Caja compliance. >>>> >>>> Note that jQuery does not use arguments.callee at all. >>>> >>>> Best, >>>> >>>> Tobie >>>> >>>> >>>> >>>> >>>> >>> _______________________________________________ >>> Es-discuss mailing list >>> [email protected] >>> https://mail.mozilla.org/listinfo/es-discuss >>> >> _______________________________________________ >> Es-discuss mailing list >> [email protected] >> https://mail.mozilla.org/listinfo/es-discuss >> > > > > -- > erik > _______________________________________________ > Es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss > _______________________________________________ Es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

