Optional Chaining (aka Existential Operator, Null Propagation)
claude.pache at gmail.com
Wed Feb 3 22:41:54 UTC 2016
> Le 3 févr. 2016 à 20:56, John Lenz <concavelenz at gmail.com> a écrit :
> Can you reference something as to why the more obvious operators are problematic?
That one (that I've used) must work, with the simple lookahead I've put in the lexical grammar, in order to continue to parse `x?.3:0` as today.
For those it is difficult for the parser to easily (i.e. quickly, without trying and backtracking code of arbitrary length) distinguish from the conditional operator, as in: `x ?(y - 2) + 3 : 0` Also, the difference of precedence level between the two operators makes the use of a cover grammar (I think) impossible.
I'm not sure what that one should be used for. (If you mean the Elvis operator, it's out of the scope of the proposal.)
More information about the es-discuss