Block lambda is cool, its syntax isn't

Axel Rauschmayer axel at rauschma.de
Fri Jan 20 21:24:13 PST 2012


Various thoughts:

>> How much does the fact that a symbol *could* be used (in theory) matter in practice? Most regexes I see for valid identifiers are still of the ^[a-zA-Z_$][0-9a-zA-Z_$]*$ variety.
>> 
>> I’d expect λ to be in use in Greece, but how about ƒ (which has been mentioned many times)? It seems very appropriate and is even easy to type on a Mac (easier than square brackets on a German keyboard!).
> 
> It's hard to type λ on many keyboards. ƒ is easier, but neither is backward-compatible:
> 
> js> ƒ = 1
> 1
> js> ƒ
> 1
> js> λ = 2
> 2
> js> λ
> 2
> 
> We rejected these already for these reasons.

My thinking was: If no one ever uses λ as an identifier (not likely in Greece) or ƒ as an identifier (likely, given that most people seem to think JS identifiers must adhere to the regexes shown above) then one would be free to make them reserved tokens in ES6. Counter arguments:

- Hard to type: reading is far more important than typing, it is very easy to adapt tools to help with typing.

- Not ASCII: I hardy every encounter non-UTF text files, any more. Non-ASCII seems to work well for Fortress.

> I think "use fn;" (real pragma syntax), with the low-precedence assignment-expression fn (params) assign-expr production, wins. What do you think?

Having fn would be sweet. For many kinds of pragmas, it would be great if one could configure these per project (or per directory). Then one could put legacy code in one directory and ES6 code in another. And the weight of the pragmas would be negligible. Not sure how to do this, though; reminds me very loosely of CSS (centralized management of style).

Would fn make sense as an ES6 breaking change? I’d expect many people to be strongly in favor, possibly as many strongly opposed.

Possible research (applies to ƒ, too):
- Poll people for their opinion
- Search JS code bases for how often the identifier "fn" is used (how?).

-- 
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/20120121/192fc385/attachment-0001.html>


More information about the es-discuss mailing list