On 13-07-30 11:16 AM, Patrick Walton wrote:
On 7/30/13 10:39 AM, Graydon Hoare wrote:
Really? How would you resolve it? You have to decide after seeing "{x:"
which grammar to switch into parsing. Currently we go with the pattern
grammar there.
Struct literals have to be prefixed with the type of the struct (as we
don't have structural record labels anymore). So we don't have arbitrary
`{x:` appearing inside patterns anymore; rather it's `Foo {x:`.
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.
Personally I prefer our current rule, where "pat:type" and "expr:type"
are the point of symmetry, and we don't try to dig further into either.
-Graydon
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev