Any ideas for lazy evaluation on varaible argument functions?

Darryl B darrylbleau at gmail.com
Fri Oct 19 09:34:52 PDT 2007


== Quote from BCS (ao at pathlink.com)'s article
> make .info look like this
> infoV(A...)(lazy A a){
>    this.info(arg.format(a));
> }
> that (or somthing like it) should work

Hmm, I think that works to preserve the laziness, but it's not really any cleaner
to do:

t.infoV!(char[], char[])("{}", expensiveFunction());
or
t.infoV!(char[], int, float, char[])("{}, {}, {}", intFunc(), floatFunc(),
charFunc());

Than it is to do:

t.info(t.format("{}", expensiveFunction()));
or
t.info(t.format("{}, {}, {}", intFunc(), floatFunc(), charFunc()));

Unless I'm misunderstanding what you're saying?



More information about the Digitalmars-d mailing list