[Arrow function syntax] Move Arrow to head to fixArrowFormalParameters issues
fremycompany_pub at yahoo.fr
Wed Jun 1 11:53:14 PDT 2011
Ok, then I'm fine with it. Please note that the current strawman still make use of the # symbol, which is why I thought you were using both of them in a future proposal.
Anyway, what do you think of my “–>” proposal for private names?
I tend to like it, since it solves one of the concern many people made for private names (that it introduced a difference between o.prop and o["prop"], and that introducing a private name force you to check all your code since all property accesses are susceptible to be modified by the insertion of the private instruction before them). Using a specific instruction for private names solves this problem completely.
It also release a special char (#,@, or whatever char you wanted to use) for other uses, since private->name works pretty well and is very consistent with obj->property. I'm not sure that @.name is really the way to go for private names since we don't have many special chars left and there are good alternative ways to solve this problem. Even if we keep the current "." approach for private names, we could use "private.name" to get a private name handle.
As I already said, I don't find it natural to define functions by writing an arrow *between* the arguments and the method body. Even mathematicians don't do this in real life. Everybody use exp(x) = Σ(x^n/n!) and not exp(x) -> Σ(x^n/n!) while this is the official notation. Not to say it becomes really strange when you don't have arguments at all, like in setInterval(=>this.doAction(), 1000);
From: Brendan Eich
Sent: Wednesday, June 01, 2011 7:42 PM
To: François REMY
Cc: Sean Eagan ; es-discuss
Subject: Re: [Arrow function syntax] Move Arrow to head to fixArrowFormalParameters issues
On Jun 1, 2011, at 10:38 AM, François REMY wrote:
> Last time I asked, it was the "#" char that was wanted for private names. If "#" has been replaced by "@" in private names, then we can replace "@" by "#" in my proposal, and return to the original proposal of #functions.
# is wanted for frozen/joined value types: joined functions with shorter syntax, records, tuples.
Hope this helps, it's not fun grabbing the last few easily-typed characters not used by JS. Quasis use ` now.
The punctuation soup argument is a bit general and overused against attribute modifiers for properties, IMHO, but it is a good countervailing force against lame single-character "land grabs" to try to shorten (some) syntax without thinking much about usability, semantics, future uses, or connotation in other languages.
> If private name uses both @ and #, I raise *severe* concerns about it.
No one ever said any such thing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss