On 28 February 2013 04:06, Axel Rauschmayer <[email protected]> wrote:
> http://wiki.ecmascript.org/doku.php?id=harmony:refutable_matching
>
> Question: Does a
>
>     Pattern "=" AssignmentExpression
>
> make sense without a prefixed question mark? For example, what would the
> result of the following statement be?
>
>     let {a: x = 1} = {};

Yes, see the runtime semantics: if x is set to undefined. For example:

  let {a: x = 1} = {a: undefined}
  print(x)  // 1

Not saying that this is a particularly useful corner case, but it is
in line with the semantics for function default arguments (which
should be a special case of pattern matching).

/Andreas
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to