On 24/11/2012, at 07:14, Brendan Eich wrote:
> Jorge Chamorro wrote:
>> 
>> 
>> Bind the name inside the function *too*.
> 
> That's not a compatible change, and unmotivated by any actual foot damage.
> 
>> The footgun (1) is to have the name bound *only* in the outer scope.
> 
> We need evidence this is a real hazard. Otherwise you're assuming a 
> conclusion and using a circular argument of sorts: that lack of the inner 
> unwritable name binding is a problem requiring just that solution.
> 
>> Yes it's a corner case.
> 
> Ok, so what's the non-corner foot-damaging case?
> 
>>> Programmers do intentionally replace a function's name in its scope, e.g. 
>>> to auto-memoize.
>> 
>> Oh, how does that work? I've written memoizers but never needed to overwrite 
>> a name.
> 
> http://osteele.com/posts/2006/04/one-line-javascript-memoization
> 
> Works on global functions as well prototype methods.

It can be done with FDs, but all the examples are using NFEs.

>>> The writable binding created by a function declaration? That's required by 
>>> backward compatibility (e.g. the memoization pattern).
>> 
>> The -outer- writable binding isn't the problem, the problem is the lack of 
>> binding in the inner scope. Is there a reason for not having it?
> 
> Again, introducing such a binding is an incompatible change. I don't know 
> what it might break, but I doubt anyone wants the risk. Also there's overhead 
> in making such an inner binding -- another reason implementors won't go 
> there. Finally, you have not justified this change by any evidence it 
> addresses a real, observed hazard.

Sorry, but I can't help thinking that fib should be bound in FDs as in NFEs:

function fib (n) {
  return (n < 2) ? 1 : fib(n-2)+ fib(n-1);
}

because if not it becomes a free var meaning that any recursive FD can be 
broken from the outside at any time, which does not seem to be the Right Way to 
do the things.

Sounds like a WTF... one that's rarely going to bit, but a WTF nevertheless.

Don't you think so?

Cheers,
-- 
Jorge.
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to