On Mar 28, 2011, at 8:30 PM, Sam Tobin-Hochstadt wrote:

> On Mon, Mar 28, 2011 at 10:16 PM, Erik Arvidsson
> <erik.arvids...@gmail.com> wrote:
>> On Mon, Mar 28, 2011 at 10:35, Allen Wirfs-Brock <al...@wirfs-brock.com> 
>> 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|.

not in my proposal

> 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).

almost, but not quite what I am proposing.
^this refers to the this binding of the function that lexically encloses the 
containing function.  this remains a reserved identifier and is not rebindable 
by block level declarations. ^this is illegal at the top level or directly in 
the direct body of a top level function because in nether case is there a 
useful outer this value to reference.


> 3. ^ as a general way to move out a scope, but restricted to |this|

not in my proposal

> 4. ^ as a general way to refer up the scope chain, for any identifier
> including |this|.

not in my proposal.

(I think I'm the only one to use the syntax  ^this in a proposal so I'm not 
sure where 1,3,4 (at least using ^this syntax) came from.

> 
> 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.

The reason I really like ^this is it co-exists very nicely with the existing 
fixed implicit this binding.  It address the primary scoping issue that arises 
from that implicit binding.  Unlike the explicit this naming forms that have 
been discussed it would work in all function definition forms without adding 
any new header syntax to any of the function definition forms. 

Allen




> -- 
> sam th
> sa...@ccs.neu.edu

_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to