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

Nathan Wall nathan.wall at live.com
Thu Jan 3 17:33:13 PST 2013


Brendan Eich wrote:
> Herby Vojčík wrote:
> > Now I am confused.
> > For (p.q?).r to be same as p.q?.r, (p.q?) must return reified Nil, not
> > undefined. I was at the impression you say "Nil at the background, but
> > whenever it becomes observable, it should be changed to undefined".
> > That means p.q? returns undefined, and (p.q?).r fails.
>
> Obviously I don't want these different parenthesizations to fail. I
> believe we can spec the semantics such that InternalNil, just like
> ES1-6's Reference type, is not observable.

What happens in more complicated expressions?

    let foo, bar = (foo = p.q?).r;

It would be strange to me if `foo === undefined && bar === undefined`. Herby's proposal that `foo === nil && bar === nil` makes more sense.

I think it would be expected for `bar = (foo = p.q?).r` to result in the same value for bar as `bar = (p.q?).r`.

Nathan 		 	   		  


More information about the es-discuss mailing list