Inner functions and outer 'this' (Re: That hash symbol)

David Herman dherman at mozilla.com
Tue Mar 29 07:26:06 PDT 2011


This is what Sam is referring to -- we've been talking about exactly such a feature. I continue to believe that something like the ^this feature we've been talking about is as likely to introduce bugs as it is to fix bugs. It's like special language support for off-by-one errors.

Dave

PS A propos of nothing, the ^this syntax probably doesn't work because of ASI; try parsing:

    x = y
    ^this.foo()

On Mar 29, 2011, at 6:47 AM, P T Withington wrote:

> On 2011-03-29, at 08:52, Sam Tobin-Hochstadt wrote:
> 
>> I agree entirely that it goes with the existing fixed implicit |this|
>> binding -- I just think that cuts the other way.  The reason we're
>> having this discussion is that the existing behavior of |this| isn't
>> always what you want, and is hard to get around because of its fixed
>> and implicit nature.  I think we should alleviate *that* problem, not
>> just the worst symptom.
> 
> Way back in
> 
> https://mail.mozilla.org/pipermail/es-discuss/2008-August/007273.html
> 
> I raised the `this` problem:  When you write a function you can choose the names of all your parameters (for maximum legibility of your code) except the implicit one, where you are forced to accept the name `this`.  If you could specify a different name, specifying which implicit binding you meant in the presence of multiples would be simplified.
> 
> I won't propose a syntax for specifying an alternative name for `this`, for fear of being taken out to the (bike)shed and getting caned, but I do think it worth considering:  why must that implicit parameter have a fixed name?
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list