Existential Operator / Null Propagation Operator

Ron Buckton Ron.Buckton at microsoft.com
Mon Apr 6 23:26:03 UTC 2015

Wouldn't `.?` as an infix operator be unambiguous, compared to `?.`? There's no place other than decimal literals where this would be legal today, and decimal literals already require either parenthesis or an extra dot to perform a property access in any event. With that lexeme, `x.?1:y` would be unambiguously an error. `1.?x:y` is unambiguously a conditional, while `1..?x:y` is unambiguously a null-propagating property access on the numeric literal `1.`.


-----Original Message-----
From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Brendan Eich
Sent: Monday, April 6, 2015 3:35 PM
To: Matthew Robb
Cc: es-discuss
Subject: Re: Existential Operator / Null Propagation Operator

Yeah, and it would line up with cover grammar needed for refutable-by-default patterns.


Matthew Robb wrote:
> On Mon, Apr 6, 2015 at 5:42 PM, Brendan Eich <brendan at mozilla.org 
> <mailto:brendan at mozilla.org>> wrote:
>     Did you keep backward compatibility? `x?.1:y` must continue to work.
> ​This is why I suggested a leading operator (`?a.?b()`) because it 
> seems like it would have the least potential for conflict with 
> existing valid syntax​
> - Matthew Robb
es-discuss mailing list
es-discuss at mozilla.org

More information about the es-discuss mailing list