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
Es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to