Motivation for compile time function execution

BCS BCS at pathlink.com
Fri Feb 16 11:31:14 PST 2007


Walter Bright wrote:
> 
> 
> The tradeoff is you won't be able to generate tuples with functions, but 
> you will be able to handle a couple orders of magnitude larger datasets 
> to work on.

That's something I'm wondering about: how to get static foreach from a 
compile time function?

One option that would be nice is to give static foreach full status as a 
static operator. This would require the static keyword (at least in some 
cases) but allow it in all the same places static if is allowed. Also 
this could allow const arrays to be used just like tuples

static foreach(char[] string; strings(some, const, data))
{
    callMe!(string)();
}




More information about the Digitalmars-d mailing list