November 23, 2015
On Monday, 23 November 2015 at 16:58:43 UTC, Andrea Fontana wrote:
> Nice. Why first enforce is "==" rather than ">=" ? This prevents something like:
>
> auto arr = ["hello", "world", "!"];
> string hello;
> string world;
>
> let (hello, world) = arr;

note that this is thedeemon's work ! (sorry couldn't resist)

anyway, yes indeed !
November 23, 2015
On Monday, 23 November 2015 at 16:58:43 UTC, Andrea Fontana wrote:
> Nice. Why first enforce is "==" rather than ">=" ? This prevents something like:
> auto arr = ["hello", "world", "!"];
> let (hello, world) = arr;

The very first post of this thread should have answered this.
Two options are available: one requires exact number of elements and so catches more errors, the other requires there to be "enough" data, for cases where you want that. To get behavior you described just use

let (hello, world)[] = arr;


November 23, 2015
On Monday, 23 November 2015 at 18:38:45 UTC, thedeemon wrote:
> let (hello, world)[] = arr;

i think what Andrea Fontana is talking is the other way around
your solution allows
let (hello, world)[] = ["hi"];

Andrea Fontana(s allows
let (hello, world) = ["hi", "there", "!"];
November 23, 2015
On Monday, 23 November 2015 at 20:10:49 UTC, visitor wrote:
> Andrea Fontana(s allows
> let (hello, world) = ["hi", "there", "!"];

of course in your version let (hello, world)[] = ["hi", "there", "!"] works
but for consistency with range, i think Fontana's note is relevant
November 24, 2015
On Monday, 23 November 2015 at 22:32:57 UTC, visitor wrote:
> On Monday, 23 November 2015 at 20:10:49 UTC, visitor wrote:
>> Andrea Fontana(s allows
>> let (hello, world) = ["hi", "there", "!"];
>
> of course in your version let (hello, world)[] = ["hi", "there", "!"] works
> but for consistency with range, i think Fontana's note is relevant

Well, I believe it's a matter of taste. By allowing different number of elements there you allow more errors to sink in without gaining anything at all. You lose the choice between strict and loose operators, erase the difference. It's not the "consistency" I would like to have.
November 24, 2015
On Tuesday, 24 November 2015 at 05:45:55 UTC, thedeemon wrote:
> Well, I believe it's a matter of taste. By allowing different number of elements there you allow more errors to sink in without gaining anything at all. You lose the choice between strict and loose operators, erase the difference. It's not the "consistency" I would like to have.

ok, always curious about strategic choices, thanks :-)
1 2 3 4
Next ›   Last »