DMD 0.166 release

Ivan Senji ivan.senji_REMOVE_ at _THIS__gmail.com
Fri Sep 1 02:12:31 PDT 2006


Walter Bright wrote:
> The implicit conversion to delegate just broke too much. Instead, I'm 
> trying out Tom S.'s suggestion of using a 'lazy' parameter storage class.
> 
> http://www.digitalmars.com/d/changelog.html

Hmm, I am afraid I have to admit I'm a little bit puzzled by this lazy 
thing.

Let's say we have:

void dotimes(int count, lazy void exp)
{
   for (int i = 0; i < count; i++)
   {
     exp();
   }
}

and I can call it like this:

int x;
dotimes(5, x++);

And it works as expected and x end up being 5.

But shouldn't I also be allowed to pass in a delegate of the appropriate 
type

dotimes(5, {writefln(x); x++;});

A funny thing happens: nothing. The loop in dotimes does get executed 5 
times but delegate passed in isn't called?





More information about the Digitalmars-d-announce mailing list