On 21/06/2010 21:51, Tomek Sowiński wrote:
Dnia 21-06-2010 o 21:57:49 Alix Pexton <alix.dot.pex...@gmail.dot.com>
napisał(a):

There is only one mention of lazy evaluation in the index and it
doesn't mention the lazy k/w at all. I seem to remember Andrei
dislikes it, but also that there is another way to get function params
to be evaluated lazily without using it.

Yeah, speaking of which - what happened to that proposal*?

*The proposal AFAIR was (correct me if wrong): if a function has a
parameterless delegate as a parameter, then on the call site any
expression in the delegate slot is implicitly turned into a delegate. I
think the delegate ought to be pure to make the magic happen.

Yeah, speaking of which - do/will we have pure delegates?


Tomek

This is the "trick" I was refering to, from a post by the programmer formerly known as downs...

Amusing D facts: typesafe variadic arrays are lazy!
>
> Did you know the following code compiles?
>
> > > module test;
> > >
> > > import std.stdio;
> > >
> > > void Assert(bool cond, string delegate()[] dgs...) {
> > >   debug if (!cond) {
> > >     string str;
> > >     foreach (dg; dgs) str ~= dg();
> > >     throw new Exception(str);
> > >   }
> > > }
> > >
> > > void main() {
> > >   Assert(false, "O hai thar! ");
> > > }
>
> It's true! :)

A...

Reply via email to