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

Kam Kasravi kamkasravi at yahoo.com
Thu Mar 31 22:04:05 PDT 2011


Thank you Allen for the references and analysis. It's interesting that Gilad argues resolution should be lexical followed by inheritance to avoid 'unanticipated name capture' that may exist within the inheritance chain. Probably even less of an option given backward compatibility requirements.

On Mar 31, 2011, at 11:12 AM, Allen Wirfs-Brock <allen at wirfs-brock.com> wrote:

> 
> On Mar 31, 2011, at 10:32 AM, Kam Kasravi wrote
> 
>> How reasonable would it be to treat 'this' in a similar way that the prototype chain is referenced when resolving identifiers? I realize there would be ambiguity for like named identifiers but that problem exists now... In Allen's first example this.handleClick(this,e) would not be resolved with it's implicit binding to elem, so 'this' would be bound lexically and the code would just work. The second 'this' would of course default to the implicit bindin
> 
> Other languages have tried to integrate inheritance based binding with lexical binding.  See f http://dyla2007.unibe.ch/?download=dyla07-Gilad.pdf  and http://bracha.org/newspeak-modules.pdf  for one example and additional references.
> 
> There are some complications to this approach and it seems to me that it is unlikely to be something that could be retrofitted in JavaScript. 
> 
> Allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110331/d6d4a38b/attachment.html>


More information about the es-discuss mailing list