On 09/05/2011 08:19 PM, kenji hara wrote:
2011/9/6 Simen Kjaeraas<[email protected]>:
On Mon, 05 Sep 2011 13:05:23 +0200, bearophile<[email protected]>
wrote:

Robert Jacques:

Seconded.  StaticIota is extremely useful for loop unrolling
optimizations, e.g.:

vote++

vote--

StaticIota is not the good solution. I have explained why elsewhere:
http://d.puremagic.com/issues/show_bug.cgi?id=4085

Certainly we could sit in a corner and pray to almighty Walter that this be
implemented, when he's done with the things he wants to do with D. Oooor -
we
could add StaticIota to Phobos, bypass the problem, and live happily ever
after.

Yes, static foreach would be nice, but the means to do what it would do, are
easily implemented in the language as is.

Agreed to Simen. The foreach statement already has loop unrolling
feature. To use it, we can pass a compile-time sequence (like
TypeTuple) as its aggregator.

I think it is clear language design, and not need more. Then we need staticIota.


static foreach is part of the design. The only reason it is not in the compiler (and we have the kludgy foreach that works on tuples) is because Walter experienced implementation difficulties.

How would you generate a number of declarations with the current foreach and StaticIota?


Reply via email to