Andrej Mitrovic:
<quote>
And, this syntax (currently it is not enough documented)
foreach (x, y; zip([1,2,3], ["a","b","c"])) {}
</quote>
Well that kinda sucks, I was just getting used to this
syntax..But for
me it it was too magical to begin with, so I have no real
complaints.
I have recently asked to remove that from the language, because
it's not flexible and it has problems:
http://d.puremagic.com/issues/show_bug.cgi?id=9817
It feels like D and Perl had
lots of booze and made it to the mile-high club, and one of
them got pregnant.
Perl is hermaphrodite, after all.
<quote>
if (auto {1, y} = tup) {
// If the first element of tup (tup[0]) is equal to 1,
// y captures the second element of tup (tup[1]).
}
</quote>
That looks like black magic to me.
<quote>
int x = 1;
if (auto {$x, y} = coord) { ... }
// If the first element of coord is equal to 1 (== x), 'then'
statement wil be evaluated.
</quote>
I really don't think we need this magic..
...
I just thinks this adds way too many features at once. I'd
argue we
should take it slow and start with some basic ability to define
and
unpack tuples, and then gradually add these other features *if*
they're really wanted.
I kind of agree. In my answer to Kenji I have suggested to split
the DIP into two DIPs, Stage1 and Stage2 and move four features
in the second Stage. This will have several advantages, for their
design, implementation and learning.
The new meaning of $ and $var and literals in if statements and
"...",
is just too much for me to take.
In my answer to Kenji I have suggested possible alternatives.
Bye,
bearophile