Dynamic closure vs static closure

Bill Baxter wbaxter at gmail.com
Sat Oct 25 01:58:13 PDT 2008


On Sat, Oct 25, 2008 at 5:49 PM, Frank Benoit
<keinfarbton at googlemail.com> wrote:
> It is great to hear that this issue is getting solved.
> How will be the now syntax?
>
> I wonder if the distinction between dynamic/static closure shall be done
> on the calling site, or the called site.
>
> void foo( void delegate() dg ){
> }
> // -or-
> void foo2( void delegate() dg ){
> }
>
> void bar(){
>  int i;
>  foo({
>    i++;
>  });
>  // -or-
>  foo( scope {
>    i++;
>  });
> }
>
> Because I think, the foo method/function signature has to define if the
> delegate is escaping or not. The caller might not know it.
>
> If the signature defines this, the compiler can check that and give more
> safety.

Hmm, this makes it pretty clear I don't know what I'm talking about
when it comes to the wheres and hows and whys of dynamic closure
creation in D2.  Sorry for the noise.  (please forgive me superdan!)

What I can say for sure, is that D1 has been working pretty well for
me, so I just hope the solution doesn't involve a much more cumbersome
syntax for things that used to work fine in D1.

--bb



More information about the Digitalmars-d mailing list