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

Sam Tobin-Hochstadt samth at
Mon Mar 28 20:30:43 PDT 2011

On Mon, Mar 28, 2011 at 10:16 PM, Erik Arvidsson
<erik.arvidsson at> wrote:
> On Mon, Mar 28, 2011 at 10:35, Allen Wirfs-Brock <allen at> wrote:
>> Overall, I really like ^this as a narrow solution to a specific real usage problem. I'm interested in reactions and unless somebody thinks of something that seriously torpedoes it I will probably write it up as a strawman.
> I like ^this.
> We (Chromium/V8) discussed introducing 'self' as a a way to get the
> lexically bound 'this'. The main issue we could think of was that it
> might be hard for users to know when to use '^this' vs when to use
> 'this'.

There seem to be a bunch of different but related suggestions here,
some of which seem more useful than others:

1. |^this| as a new special token that always refers to the lexical
meaning of |this|.
2. |^this| as a new special way to get the version of |this| bound in
the next outer scope.  I believe that this is sometimes different from
1 (maybe just at the top level).
3. ^ as a general way to move out a scope, but restricted to |this|
4. ^ as a general way to refer up the scope chain, for any identifier
including |this|.

Personally, I think that a way to name the implicit binding of the
receiver would be better than adding more hardcoded names to the
standard.  The |^this| proposals seem problematically implicit,
especially since we had quite reasonable suggestions (at the meeting
at least) for naming |this| explicitly instead.
sam th
samth at

More information about the es-discuss mailing list