On 26.07.2010 4:48, Brendan Eich wrote:
On Jul 25, 2010, at 4:57 PM, Maciej Stachowiak wrote:

On Jul 24, 2010, at 11:51 AM, Mark S. Miller wrote:

The reason I prefer "#" to "\" is simply that JavaScript source text 
[fragments] frequently appear in literal strings. Right now, the only quoting hazard this 
introduced is quotes and backslashes in nested literal strings. (Is this true?). If you use 
backslash in syntax elsewhere in the language, then it becomes an additional quoting hazard that's 
easy to miss.

+1 on "#".
Good point about the escaping hazard. I think # may look funny to people because it is a 
"noisy" symbol and also because it is a comment delimiter in many languages.
Plus some interest in reserving it for "hash"-y dictionary literal syntax.



The same magic symbol -- # -- for several purpose is good and bad at the same time. Here it creates/defines a function, and there -- is already about "hash"-y stuff. Don't know, maybe it's good, although not so consistent for an operator which is "too magic". But, it's a variant, and maybe be, yeah, a good variant.

Two other characters totally disallowed in the syntax are @ and `, I wonder if 
either of those would be more visually pleasing:

[0, 1, 2, 3].map( #(x) {x * x} )
[0, 1, 2, 3].map( `(x) {x * x} )
[0, 1, 2, 3].map( @(x) {x * x} )
FWIW, @ is used by ECMA-357 (E4X) but that use (XML attribute names) could be 
reconciled with this one.


I also wonder if using a strictly binary operator might be workable without 
creating syntax ambiguities:

[0, 1, 2, 3].map( ^(x) {x * x} )
[0, 1, 2, 3].map( *(x) {x * x} )
[0, 1, 2, 3].map( %(x) {x * x}
If you allow such a shorthand at the start of a statement (expression 
statement), then lack of semicolon at the end of the previous statement will 
result in a binary operator expression spanning more than one line being parsed:

x = y + z
^(a){a*a}.mapOver(array)

/be

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to