On 03/28/2010 05:09 PM, bearophile wrote:
Navin Kumar:
It seems it would be more readable to have "static foreach" and simply put a 
caveat that it's only supported inside functions for now.<

I agree. I have recently written about it:
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=107873

If you see at this document (about half of those ideas are now present in D2)
http://s3.amazonaws.com/dconf2007/WalterAndrei.pdf

At page 52 you can see that Walter&Andrei too were appreciating the idea of a 
static foreach. So I presume you will see it in D3 or even sooner :-) I presume 
it's not a hard thing to implement. But Walter is busy, and Andrei's book was 
already late.

Bye,
bearophile

static foreach was part of the plan until recently, but Walter encountered severe implementation difficulties so we had to abandon it.

I agree that it's odd that the same statement iterates at compile-time or run-time depending on the iterated type.


Andrei

Reply via email to