fail-fast object destructuring (don't add more slop to sloppy mode)

Herby Vojčík herby at
Wed Jan 2 12:23:07 PST 2013

Brendan Eich wrote:
> Herby Vojčík wrote:
>> That is, these are identical, except the syntax:
>> r = o.p.q {p: {q: r}} = o
>> r = o.?p.q {?p: {q: r}} = o
>> P=o.p; Q=o.?q {p: P, ?q: Q} = o
> Here I part company only on syntax:
> r = o?.p.q {p?: {q: r}} = o
> P=o.p; Q=o?.q {p: P, q?: Q} = o
> And of course, the short-hand works:
> p=o.p; q=o?.q {p, q?} = o

Oh, now that I see details, I do not like the syntax, because the 
symmetry of use of ? vanished.

	r = o.?p.q	{?p: {q: r}} = o	// in both forms, "?p"
	r = o?.p.q	{p?: {q: r}} = o	// 1st: "o?"; 2nd: "p?"

	p=o.p; q=o.?q	{p, ?q} = o	// I can say informally
					// o.{p, ?q} meaning
					// {o.p, o.?q}
	p=o.p; q=o?.q	{p, q?} = o	// 1st: "o?(.q)", 2nd: "(o.)q?"

But of coures, if it has some serious problems / is unacceptable from 
other reasons, then different syntax must be used.

> /be


More information about the es-discuss mailing list