Optional Chaining (aka Existential Operator, Null Propagation)

Kevin Smith zenparsing at gmail.com
Thu Feb 4 20:03:14 UTC 2016

Thanks for putting this together.  At first glance, I think the semantics
look pretty good.  The syntax still seems problematic, though, from an
aesthetic point of view.

The `obj ?. prop` form looks natural and aligns well with how this feature
appears in other languages.  The other forms are less natural:

new C?.(...args)

I'm not particularly convinced by any of the other syntactic variants we've

That aside, I have a question about the semantics.  What does this do:

({ x: 1 }).x?.y.z;

Does it throw a ReferenceError?

In general, when this feature is used in other languages, do you tend to
see the optional operator stacked up for the rest of the member expression?


In order to avoid reference errors "in the middle"?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20160204/4777638b/attachment.html>

More information about the es-discuss mailing list