Default operator strawman - ||| rather than ??

T.J. Crowder tj at crowdersoftware.com
Tue Jun 12 08:29:07 PDT 2012


In the current default operator strawman[1], the operator is ??, e.g.:

a = b ?? 5;

is shorthand for

a = b !== undefined ? b : 5;

Would it be possible to use ||| instead? E.g.:

a = b ||| 5;

I ask because I was planning (prior to knowing about this strawman!) to
suggest that, along with a different form of ?? (or ???) which introduces a
new ternary operator:

a = b ?? 5 : 6;

...which would be a shorthand form of

a = b !== undefined ? 5 : 6;

[1] http://wiki.ecmascript.org/doku.php?id=strawman:default_operator

-- T.J.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120612/657a738c/attachment.html>


More information about the es-discuss mailing list