Accessing anonymous reference inside with block

Stanislav Blinov blinov at
Mon Oct 18 05:14:06 PDT 2010

  15.10.2010 19:43, Andrej Mitrovic wrote:
> Related: A nice alternative for quickly using anonymous objects is
> using the with statement, e.g.:
> with (new Foo)
> {
>      foo();
>      // ... more code
> }
> And after the with block the object doesn't exist anymore.
> Or you could bind it to some internal reference and keep it there,

I must ask, how can this binding be achieved?

> which wouldn't destroy it after exiting the with block. Many of the DFL GUI
> library code samples work this way, and it's quite a nice syntax imo.

More information about the Digitalmars-d-learn mailing list