Proposal: opt-out local scoping

P T Withington ptw at pobox.com
Fri Aug 29 08:03:23 PDT 2008


On 2008-08-28, at 16:52EDT, Brendan Eich wrote:

> On Aug 28, 2008, at 1:23 PM, P T Withington wrote:
>
>> I'd like to have a syntax where this is _not_ implicitly bound.  One
>> idea would be to riff on default arguments:
>>
>>   function example (receiver=this, ...
>
> Why wouldn't you use |this| for the parameter name? We did for type- 
> annotating |this| in various proposals.

In a function (that is not a method of a class), forcing me to call  
the -1th parameter of the function 'this' seems Procrustean.

> Some functions have a bound |this| when you extract them. Such  
> override attempts would fail. Throw or fail silently?

I'm just asking that I be able to use a name other than 'this' for my  
-1th parameter, should I so choose; especially in functions outside of  
a class.  The magic binding of the -1th parameter of a function inside  
a class to the instance it was extracted from should be independent of  
the name of that parameter.



More information about the Es-discuss mailing list