> ?? would work better than ? in JavaScript, because it wouldn’t clash with the > conditional operator in JavaScript > > Wouldn't it be possible to use a single '?' for all of them (the conditional, > default and existential operators) and disambiguate between them according to > the way they're used? It seems to me like their syntax is different enough to > allow it - the default operator would have no `: ElseExpression` following it > and the existential operator is not followed by anything.
I don’t think it would be worth it. You’d save one character and it would still be confusing to humans. > Also, should they be allowed on all expressions or just identifiers? It would > be quite useful on arbitrary expression, like `func() ?? default` or `if ( > (res = func())? ) /* do more stuff with `res` */`. Absolutely. > P.S. Are CoffeeScript's `func? arg` and `obj?.prop` too extreme? The former is part of Crockford’s proposal [1]. The latter is very useful indeed. [1] http://wiki.ecmascript.org/doku.php?id=strawman:default_operator -- Dr. Axel Rauschmayer a...@rauschma.de home: rauschma.de twitter: twitter.com/rauschma blog: 2ality.com
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss