On 09/25/2015 09:38 AM, Artur Skawina via Digitalmars-d-learn wrote:
On 09/25/15 17:47, Ali Çehreli via Digitalmars-d-learn wrote:

Perhaps we need an enhancement that either works in your original code [...]

His original code does work (`foreach` evaluates `args[N]` and
assigns the result to `arg`).

If he wanted to delay the evaluation, he would have written it
like this:

    void test(T...)(lazy T args)
    {
        foreach(I, _; typeof(args))
        {
            writeln("about to process arg");
            writefln("processing arg %s",args[I]);
        }
    }

artur


Awesome! :)

Ali

Reply via email to