Existential Operator / Null Propagation Operator
isiahmeadows at gmail.com
Thu Oct 29 22:12:32 UTC 2015
1. `foo?.3:.5` should be unambiguously `foo ? 0.3 : 0.5`, because `3` is a
number, not an identifier. `foo?.3` in any other context should be a syntax
error. It's also inconsistent with array access otherwise.
2. I wouldn't have a problem with `object?.[prop]`, since that's only one
character more. It's still a lot easier.
On Thu, Oct 29, 2015, 18:00 Claude Pache <claude.pache at gmail.com> wrote:
> >> Le 29 oct. 2015 à 21:04, Waldemar Horwat <waldemar at google.com> a écrit
> >> On 10/29/2015 12:19, Laurentiu Macovei wrote:
> >> `foo?.bar` and `foo?['bar']` syntax would work too.
> > No. It would break existing code:
> > x = foo?.3:.5;
> That could be resolved by a simple lookahead, I think.
> > x = foo?[a]:[b];
> That one is more problematic. IIRC, it was once suggested to use`?.[`
> > On the other hand, turning .. into a token should be fine.
> > Waldemar
> > _______________________________________________
> > es-discuss mailing list
> > es-discuss at mozilla.org
> > https://mail.mozilla.org/listinfo/es-discuss
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss