www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - tuple foreach is missing the boat

This doesn't work:

void main()
	foreach (i,t;T!(Ty!(int), Ty!(short), Ty!(byte)))
		t.Type foo;

template T(t...){alias t T;}

template Ty(T) { typedef T Type; }

as far as I know, the spec doesn't say it should fail. The reason I can 
across this is in dparse, I build a parse tree that I then have to 
traverse with tuple foreaches. To make that work, I'm forced to use 
tuples of types (In my case struct) and that is causing all sort of 
issues with my compile time programming*. If this is fixed, it will be a 
major boon to compile time processing.

*I'm not positive that this is the case, but based on how things run I 
expect that what is happening is that the piles of type I'm generating 
is creating huge amounts of TypeInfo data and bloating my program as 
well as soaking DMD at compile time.

If no one comes up with a reason this shouldn't work, I'm going to 
submit a bug report.
Sep 19 2007