`this`: methods versus functions

Axel Rauschmayer axel at rauschma.de
Thu Nov 10 06:23:38 PST 2011

Any suggestion for improvement is highly welcome. But it seems like we can’t do better than a construct that declares statically, how its `this` should be passed to it. The cool thing about block lambdas is that you do the right thing without thinking about it. That’s why, if we got arrow syntax instead, I would opt for only having the fat arrow (given that we already have a shorter syntax for methods inside object literals).

I wonder if it made a difference if `this`was always stored in an environment (instead of an execution context). Then block lambdas could find them via the scope chain.

On Nov 10, 2011, at 15:11 , Andreas Rossberg wrote:

> On 10 November 2011 14:49, Axel Rauschmayer <axel at rauschma.de> wrote:
>> getX() is designed for a dynamic `this` (i.e. `this` is an instance of
>> InnerPoint). My proposal would allow an external party to switch to lexical
>> `this` (=== function Outer), simply by invoking it as a (non-method)
>> function. I can see how this would be bad.
> Ah, OK, never mind. I think I was actually misreading your proposal.

Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111110/d8956a07/attachment-0001.html>

More information about the es-discuss mailing list