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.


> 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
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to