Existential Operator / Null Propagation Operator

Brendan Eich brendan at mozilla.org
Tue Apr 7 21:17:21 UTC 2015

Nathan White wrote:
> Am I crazy to think that "Nil" could allow the Existential Operator to 
> be used in assignments as well?
> var a = undefined;
> a?.b?.c?.d = 1;
> console.log(a); // {b: {c: {d: 1}}}
> Too powerful / abusive?

Too error-prone. E4X (ECMA-357) and languages such as Borland's 
mid-nineties "Lucy" (Loose C) allow you to cons up deep structures just 
be expressing member references. One typo and you're lost.

> Day dreaming, use U+02D9 (DOT ABOVE) as the operator.
> a˙b˙c.d

Object literal notation is explicit and pretty concise. What's the hot 
use-case driving your desire here?


More information about the es-discuss mailing list