Name elision

Function arguments are just irrefutable patterns, so they shouldn't be special -- if it works in a function argument it should work in other pattern positions too.

Personally I'd say definitely to braced-struct patterns and braced-struct literals.

Tuple structs I don't really know, because in expressions they're just function calls (RFC#1506), so the parallel to "well there are lots of places where _ mean to infer the type" isn't so good. As a workaround one could just do foo(a, b, ☃ { 0: c, 1: d });, but that also makes me think that part of the goodness of this syntax is the expectation that the field names are what makes this readable in the first place, and maybe it would be good for foo(a, b, ☃(c, d)); to not work, since it feels like maybe it should have just taken a normal tuple at that point. At least it seems like enough justification that it could be left out of an MVP -- maybe later we'd go "oops, should have included that", but we can find out over time.

That also brings up the related feature for enums, like being able to ☃::V4(v4) => v4.is_link_local(), in a match:

3 Likes