On Sat, Oct 11, 2008 at 10:02 AM, Mark S. Miller <[EMAIL PROTECTED]> wrote:
> On Sat, Oct 11, 2008 at 9:11 AM, Peter Michaux <[EMAIL PROTECTED]> wrote:
>> As it stands, I always write the following in ES3
>>
>> var f = function() {};
>>
>> and now that arguments.callee is on the chopping block, I've started
>> writing recursion as the painful contortion below
>>
>> var f = (function() {
>> var callee = function() { callee(); };
>> return callee;
>> })();
>
> I don't get it. Why not write
>
> var f = function() { f(); };
var f = function() {f();};
var g = f;
f = function(){alert('broke your recursion :)');};
g();
The call to g will not create an infinite loop which is the intended
behavior of the function object defined in the first line. The late
binding of the recursive call to whatever f happens to reference is
the problem.
Peter
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss