2015-06-02 18:57 GMT+02:00 Brendan Eich <[email protected]>:

> 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:
>
> ?obj[key]
> obj[?key]
> obj[key1][?key2]
>
> and if you are not using computed property names, rather literal ones:
>
> obj.?prop1
> etc.
>

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
prefix notation.
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to