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

Herby Vojčík herby at
Wed Jan 2 08:18:33 PST 2013

Brendan Eich wrote:
> Herby Vojčík wrote:
>> I advised adding Null Pattern Object into language in the
>> aforementioned thread; and use foo? as `foo == null ?
>> NullPatternObject : foo`.
>> With such construct you could do
>> let {p: {q: r}} = deep_o?;
> This does not address the problem for destructuring. It's true a Nil
> object (as Brandon Benvie prototyped:
> can be deeply
> destructured.

That is what I meant.

> But there is no refutable match future. We need an

I don't understand. :-/

> exception on missing property, not a magic get/set-sink object.

Without ?, it can throw. With it, it does not because of how Nil works.

> The suffix-? syntax in expressions is problematic in combination with
> missing semicolons. You get another case where programmers expect ASI
> but there's no error to correct:
> x = y?
> z:w
> where z is label and w is a statement that can syntactically (if not
> sensibly) be labeled.

... or whatever other syntax. It's about Null Pattern idea, not the 
actual syntax.

> /be


More information about the es-discuss mailing list