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

Herby Vojčík herby at
Wed Jan 2 13:41:06 PST 2013

Brendan Eich wrote:
> Herby Vojčík wrote:
>> In the short example you sketched, with case {must, ?may} there is no
>> need to diverge from the destructuring; so I did not even imagine such
>> divergence for the moment.
> Should a proxy in the head of a match be able to observe case-by-case
> refutation?

I'd say no, it should be done transparently be the language itself, via 
that (foo==null?nil:foo) desugaring. But that's mostly a feeling (the 
question is, how to whether foo==null is done by some shortcut without 
actually getting foo, proxy may then observe that shortcut).

>>> We need to detail how Nil works, how it cannot be wrapped or observed,
>>> etc. in order to maintain equivalence.
>> In my naive view, [[GetP]] returns Nil, [[SetP]] does nothing,
>> [[Call]] return Nil. But there are sure some nasty details down there.
> Yeah, this is unsafe by design, if the spec has a bug then Nil leaks
> out. Want undefined in ES6, not Nil.

I don't understand the unsafety. If Nil is observable part of the 
language, then this is natural semantics. If it should be hidden, that's 
another story.

> /be


More information about the es-discuss mailing list