- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
Description
These are minor nitpicks, but they might as well be fixed before it's too late.
struct Foo(int, int, int, int);
struct Bar{a: int, b: int, c: int, d: int};Ignoring all the fields is inconsistent:
let Foo(*) = Foo(5, 5, 5, 5);
let Bar(_) = Bar{a: 5, b: 5, c: 5, d: 5};It doesn't seem like it's currently possible to ignore all fields of a regular tuple.
I think this would be nicer:
let Foo(*) = Foo(5, 5, 5, 5);
let Bar(*) = Bar{a: 5, b: 5, c: 5, d: 5};
let (*) = (5, 5, 5, 5);With a struct, you can ignore "the rest", but you can't with a tuple struct or tuple:
let Bar{b: b, _} = Bar{a: 5, b: 5, c: 5, d: 5};This would be more consistent, and similar to destructuring fixed-size vectors:
let Foo(a, b, *) = Foo(5, 5, 5, 5);
let Foo(*, d) = Foo(5, 5, 5, 5);
let (a, b, *) = (5, 5, 5, 5);
let (*, c, d) = (5, 5, 5, 5);
let Bar{b: b, *} = Bar{a: 5, b: 5, c: 5, d: 5};An underscore would mean ignoring one field.