Existential Operator / Null Propagation Operator

Isiah Meadows isiahmeadows at gmail.com
Fri Oct 14 02:11:55 UTC 2016


On Thu, Oct 13, 2016, 12:07 Claude Pache <claude.pache at gmail.com> wrote:

Le 13 oct. 2016 à 17:14, Kagami Rosylight <saschanaz at outlook.com> a écrit :


>IIRC the proposed syntax for computed properties was x?.[y],

Yes you’re right, sorry :/

IMO it still seems the syntax problem is the main reason why this proposal
has stalled. If not, what is the problem here?


The issue with `?.[` is that it is considered as not pretty by some people.
A syntax that is at the same time pretty, technically working, and not
confusing is difficult to find.


I agree with both points here. It's not very pretty, and it's also
inconsistent with the rest of the language. I was just clarifying what I
believed to be the primary contender, independent of bias.


Concerning your suggestion of using `!`: From a technical point of view,
using `![` instead of `?.[` may work only if you forbid a line terminator
before the `!`, because the following program is valid as of today (with
implied semicolons):


```js
foo
![42]
```


I want to like the idea, but many languages (e.g. Swift, Kotlin, and I
think TypeScript 2.0) use it in the inverse direction: non-null assertion
for nullable types. I'm not sure I like the syntax in either form (it has
at least the ability to be non-ambiguous).


I’m curious why this proposal is not even listed in stage 0 proposal list.


Because no representative of TC39 has volunteered to champion it.


—Claude
_______________________________________________
es-discuss mailing list
es-discuss at mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20161014/e0c35ab4/attachment-0001.html>


More information about the es-discuss mailing list