T.J. Crowder wrote:
On 14 June 2012 18:10, Brendan Eich <[email protected]
<mailto:[email protected]>> wrote:
I agree on reflection with Wes and others who've objected that A
?: B has the simplest interpretation as A ? A : B and therefore
should not be used for anything like (A !== undefined) ? A : B or
(A != null) ? A : B. I noted this as an open issue but I'm almost
ready to flip the strawman back to ?? and ??=. Comments on syntax?
Do people see sufficient value in a second ternary operator that uses
the same semantics for what's a non-value? E.g.:
a = b ?? c : d;
meaning
a = b !== undefined ? c : d;
No, too thin.
Also preempts ?? as an infix operator, which has been proposed for quite
a while as the default operator.
If people *don't* see sufficient value in the second ternary (and the
use cases are pretty limited), ?? and ??= are great. Ship 'em.
Not in ES6, but I'm working on the strawman to get them into Harmony, so
they can be prototyped, user-tested, and standardized in due course.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss