Default operator strawman - ||| rather than ??
Peter van der Zee
ecma at qfox.nl
Tue Jun 12 13:37:33 PDT 2012
On Tue, Jun 12, 2012 at 5:29 PM, T.J. Crowder <tj at crowdersoftware.com> wrote:
> In the current default operator strawman, the operator is ??, e.g.:
> a = b ?? 5;
> is shorthand for
> a = b !== undefined ? b : 5;
I missed this discussion. What validates the introduction of this
syntax over the equally simple and already possible `a = b || 5`? Is
the comparison to `undefined` (and why not `==null` as well??) really
worth the introduction (and subsequent loss of future usage) of the
double question mark? Whatever it's usual name is (double wat?).
> Would it be possible to use ||| instead? E.g.:
> a = b ||| 5;
If the above is "this, absolutely" and such a feature, I favor this as
well because it resembles the `a = b || 5` expression better.
>  http://wiki.ecmascript.org/doku.php?id=strawman:default_operator
(Read that before posting, did not see anything compelling)
More information about the es-discuss