Re: What is the corect behavour for lazy in foreach variadic template

2015-09-25 Thread Ali Çehreli via Digitalmars-d-learn
On 09/25/2015 05:56 AM, Sean Campbell wrote: Take the following code for example module test; import std.stdio; void test(T...)(lazy T args) I don't think that syntax is implemented. It looks valid to me though. There are many qualifier combinations that the compiler is silent about. I

Re: What is the corect behavour for lazy in foreach variadic template

2015-09-25 Thread Artur Skawina via Digitalmars-d-learn
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

Re: What is the corect behavour for lazy in foreach variadic template

2015-09-25 Thread Ali Çehreli via Digitalmars-d-learn
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

What is the corect behavour for lazy in foreach variadic template

2015-09-25 Thread Sean Campbell via Digitalmars-d-learn
Take the following code for example module test; import std.stdio; void test(T...)(lazy T args) { foreach(arg;args) //bar is invoked here { writeln("about to process arg"); writefln("processing arg %s",arg); //but it should be invoked here, right? } }