Existential Operator / Null Propagation Operator

Waldemar Horwat waldemar at google.com
Thu Oct 29 23:07:28 UTC 2015


On 10/29/2015 14:20, Claude Pache wrote:
>
>> Le 29 oct. 2015 à 19:32, Eli Perelman <eli at eliperelman.com> a écrit :
>>
>> 2 dots may be problematic when parsing numbers (yeah, I know it's probably not common, but it's still valid):
>>
>> 3..toString()
>>
>> Eli Perelman
>
> Treating `..` as one token would be a breaking change,

Exactly what existing code would it break?

> but I don't think it is a problem in practice, as `3..toString()` would continue to work.

It would continue to work for the trivial reason that `3..toString()` doesn't contain a .. token.  It's the number 3. followed by a . and then an identifier and parentheses.

This is no different from 3.e+2 not containing a + token.

  In some cases – as in `3..toStrign()` –, `undefined` will be produced where an error was thrown.

No, this would continue to throw an error.

     Waldemar



More information about the es-discuss mailing list