Tuple DIP
Guillaume Boucher
guillaume.boucher.d at gmail.com
Wed Jan 17 00:50:42 UTC 2018
On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote:
> foreach((sum, diff); [(1, 2), (4, 3)].map!((a, b) => (a + b, a
> - b)))
> {
> writeln(sum, " ", diff);
> }
I'm not a big fan of the foreach syntax. It's so easy to forget
or accidentally add parentheses while coding, or read it wrongly
while skimming over the code.
Not sure if anything can be done against that, though. Maybe add
an alternate "for (.. in ..)" syntax that doesn't have that
problem?
More information about the Digitalmars-d
mailing list