On 13-07-30 11:36 AM, Patrick Walton wrote:
On 7/30/13 11:34 AM, Graydon Hoare wrote:
You still have to decide what to parse after you saw "Foo {x:". If it's
subpat, then you can't put a type ascription there. Maybe that's
semantically unproblematic since Foo uniquely types its fields. But that
breaks the symmetry with type-follows-":" in expr context. Now type
follows ":" in _some_ places in pat, but pat follows ":" in other places.

You're saying it causes problems with `let Foo { x, y } = ...;", to be
more specific. That's true, yes.

Or other places.

match thing {
  Foo { x:a, y:b } => ...
}

Is 'a' a type or a pat? Currently it's a pat. If we make it a type (to mirror the expr form) then we can't destructure fields recursively with subpats. If we keep it a pat then it'd be an exception to the putative rule "types follow : in pats".

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to