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 <[email protected]> wrote:

>
>
> >> Le 29 oct. 2015 à 21:04, Waldemar Horwat <[email protected]> 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`?.[`
> instead.
>
> —Claude
>
> >
> > On the other hand, turning .. into a token should be fine.
> >
> >    Waldemar
> >
> > _______________________________________________
> > es-discuss mailing list
> > [email protected]
> > https://mail.mozilla.org/listinfo/es-discuss
> _______________________________________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/es-discuss
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to