Re: Kill as soon as possible the special case handling of tuples in foreach

2015-01-06 Thread bearophile via Digitalmars-d
deadalnix: Tuple unpacking is necessary for things like bypair. Why not unpack consistently ? I'm all for unpacking consistently, but to reach consistency you first have to break something, the iteration on arrays or the iteration on ranges of tuples. The first is documented and it's presen

Re: Kill as soon as possible the special case handling of tuples in foreach

2015-01-06 Thread deadalnix via Digitalmars-d
Tuple unpacking is necessary for things like bypair. Why not unpack consistently ?

Re: Kill as soon as possible the special case handling of tuples in foreach

2015-01-06 Thread Vlad Levenfeld via Digitalmars-d
I loved this feature when I first found out about it but after reading your arguments against on the bug tracker I have to agree with your position. It would be much nicer if it worked with uniform tuple syntax like foreach (i, {x,y}; [tuple('a',`b`),tuple('c',`d`)]) where i is size_t and x

Kill as soon as possible the special case handling of tuples in foreach

2015-01-06 Thread bearophile via Digitalmars-d
I strongly suggest to "burn with fire", I mean, warn and then deprecate the special case of automatic tuple unpacking in foreach loops in dmd 2.067: void main() { import std.typecons, std.range; auto data1 = [tuple("red", 10), tuple("blue", 20)]; foreach (x, y; data1) { pr