Existential Operator / Null Propagation Operator

Herby Vojčík herby at mailbox.sk
Tue Apr 7 09:38:34 UTC 2015

Kevin Smith wrote:
> We should perhaps review this old thread:
> https://esdiscuss.org/topic/fail-fast-object-destructuring-don-t-add-more-slop-to-sloppy-mode
> for another possible way to avoid non-compositionality.  (Look for the
> suggestion about "Nil".  It's basically an exotic falsey object which
> returns itself for any property lookups or calls.)

Yeah, that's the Null Pattern I mentioned few posts before. I remember I 
suggested this to be part of the language itself, as a first-class 
member, but it seems it wasn't legible; OTOH, it seemed to be good 
enough to use while still in the level of references, but when coming 
back to values, it was suggested to be changed to undefined.

It is still interesting question if it could be part of the language 
itself, but even if not and only applicable as a reference, it can be a 
good solution (it that case a?.b.c would yield undefined, not an error 
in case a is null).


More information about the es-discuss mailing list