destructuring: as patterns?

Andreas Rossberg rossberg at google.com
Wed Apr 18 08:57:42 PDT 2012


On 18 April 2012 17:51, Herby Vojčík <herby at mailbox.sk> wrote:
> Maybe allowing
>  let {b, b:{x,y}} = obj;
> would be enough. It sort-of comforms to existing syntax as well as
> semantics.

That won't work for arrays, for example.

I agree that 'as' patterns (and even more so, wildcard patterns) are
basic building blocks that are currently missing. They are extremely
useful in practice, for a very small price -- i.e., they are trivial
to spec and implement, (unlike callable objects, because Brendan just
mentioned those :) ).

/Andreas


More information about the es-discuss mailing list