shortcuts for defining block-local private names, plays nicely with @foo syntax

Axel Rauschmayer axel at rauschma.de
Mon Jan 23 01:48:26 PST 2012


Note: JavaScript will never go the Java or C# route of including properties in local scope (which would be just like `with`), there will just be a shortcut for `this` (so IDEs won’t have a problem).

But I agree with your other points: my taste is such that 5 chars are not worth the increase in grawlixiness and I enjoy the symmetry induced by the longer `this`.

On Jan 23, 2012, at 10:41 , François REMY wrote:

> Just to confirm: you are not alone. I always thought that allowing to imply local this (‘this.’) was a bad idea (C#). Seriously, this is not 5 chars that’ll hurt but it could make IDE work a lot easier, and it make code reuse more efficient (if you need to copy/paste some code, if you stay in the same class, it will work as intended, not if a function argument can override the class field). It also brings symetry to the code (this.a==other.a).
> From: Axel Rauschmayer
> Sent: Monday, January 23, 2012 10:26 AM
> To: Brendan Eich
> Cc: ECMAScript discussion
> Subject: Re: shortcuts for defining block-local private names,plays nicely with @foo syntax
>  
>>> function Point(everyone, secret) {
>>>   .everyone = everyone;
>> 
>> You're requiring manual semicolon insertion before lines like this. Consciously?
> 
>  
> Sight. Right. Not a good idea, then.
>  
> An important consideration is that eliminating `this` will increase the grawlix-factor of JavaScript (I always liked the explicit `this`, especially compared to Java).
>  

-- 
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/20120123/abff2d9a/attachment-0001.html>


More information about the es-discuss mailing list