On 11 July 2012 17:20, Russell Leggett <[email protected]> wrote:
> On Wed, Jul 11, 2012 at 7:14 AM, Andreas Rossberg <[email protected]>wrote: > >> AFAICS, '?' on a variable itself would always be redundant, because a >> variable pattern is irrefutable anyway. >> > > So you're saying that even this should match in a refutable pattern: > > let [a,b,c] = [1,2]; > > I would expect that to fail, especially in a hypothetical pattern matching > construct. > That would fail because the array pattern is refutable. What I meant is something else, namely that there is no difference between these: let x = ... let ?x = ... or these: let {x: x, y: y} = ... let {x: ?x, y: ?y} = ... Pattern matching recursively decomposes the RHS and matches a (sub)value against the respective (sub)pattern of the LHS. Once you reach a variable, that submatch is unconditional, so a '?' doesn't change anything. /Andreas
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

