On Wed, Sep 12, 2012 at 12:14 AM, Niko Matsakis <[email protected]> wrote:
> On 9/11/12 12:54 AM, James Boyden wrote:
>>
>> I would also argue that such a single-'let'-out-front concession
>> should not be applied to struct patterns: One of the key benefits
>> of introducing 'let' in struct patterns is to disambiguate variable
>> bindings from struct field names, which requires having the 'let'
>> directly in front of the variable binding.
>
> So you would write:
> let Foo { x: let x, y: let y } = ...;
> ?
I was referring to struct destructuring inside a match pattern,
so there would never be a 'let' in front of 'Foo', nor an assignment
after the closing brace; it would just be:
Foo { x: let x2, y: let y2 } => /* Do something with x2 and y2 */
Are you saying that struct destructuring also occurs outside of
match constructs, as a stand-alone assignment statement?
It was my understanding that only tuples appear in (and require)
a stand-alone destructuring assignment statement, since struct fields
can be accessed using the dot operator.
Thanks,
jb
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev