> Le 4 févr. 2016 à 21:03, Kevin Smith <[email protected]> a écrit :
>
>
> That aside, I have a question about the semantics. What does this do:
>
> ({ x: 1 }).x?.y.z;
>
> Does it throw a ReferenceError?
>
Yes: the `?.` operator does not change the meaning of the subsequent `.`
operator. I like to think of it as: the effect is local (short-circuiting
aside), you are not switching between "modes". It’s a feature.
Maybe I should write a desugaring in my proposal. The expression `({ x: 1
}).x?.y.z` is equivalent to:
```
(function () {
var $1 = { x: 1 }).x;
if ($1 == null)
return undefined;
return $1.y.z;
})()
```
—Claude
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss