Any ideas for lazy evaluation on varaible argument functions?
BCS
ao at pathlink.com
Fri Oct 19 22:59:50 PDT 2007
Reply to Daniel,
> Sadly, I don't think there's any way to fix this. The problem is that
> if you've got IFTI (which is what allows you to omit the explicit
> template instantiation), the arguments can't be very complex. What
> you would need is something like this:
>
What is needed is some way to get at the list of type used and munge them
before they are pushed into the args list.
I don't think this will work but something like this could be scabbed in
somehow:
void TFunc(A...)(lazy A : ConvertStatic2Dynamic!(A) a) {...}
somehow the syntax* would have to say that A is the types that the function
*would* be IFTIed on but just use that for the tuple and then I'll tell you
what to really use. This would also solve a number of other problems like
this:
void TFn(T)(T a, T b){...}
char[] world;
TFn("hello", world); // woops!
you could use this:
void TFn(T)(T a, T : T b){...}
to say that only the second arg should be used for ITFI, or even have the
type derived like in the first case.
* That is what the "A : ..." is supposed to convey, but I'm open to better
suggestions.
More information about the Digitalmars-d
mailing list