Existential Operator / Null Propagation Operator
sanderd17 at gmail.com
Tue Jun 2 17:31:41 UTC 2015
2015-06-02 18:57 GMT+02:00 Brendan Eich <brendan at mozilla.org>:
> You might hope for that, but as we both noted, `?[` is not going to fly.
> Don't break the (minified) Web.
Which is why my proposal was about `??`. I believe there's currently no
valid way to use a double question mark in JS, so even `??[` should be
easy to figure out what it means.
> The prefix idea generalizes:
> and if you are not using computed property names, rather literal ones:
I found this syntax to conflict with itself. As Andreas Rossberg says, what
does `orders[?client.key].price` mean? Does it mean "check if the client
exists, and if not, return the price of the null order", or does it mean
"check if the order for this client exists, and return null if it doesn't"?
I don't see a way how both meanings can be made possible with this form of
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss