-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

#ponce wrote:
> When I started D, it was possible to define a scope class like this.
> 
> scope class Something
> {
> // blah
> }
> 
> An instance declaration would then _require_ the scope storage class.
> 
> 
> {
>     scope Something myVar;
>    // do something with Something
> }
> 
> Is there a use case for such a feature.?

Yes. One of the uses is when you are wrapping some sort of OS resource.

I've got a scope class which I use for file access;
stops you accidentally leaving the file open & locked.

I also use scope classes for storing intermediate results in complex
algorithms when I want deterministic collection. Use scope classes
and it all gets cleaned up when the algorithm finishes.

- --
My enormous talent is exceeded only by my outrageous laziness.
http://www.ssTk.co.uk
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFLQ4cJT9LetA9XoXwRAsv8AJ0TiP7Qy4kOKf0WmWPuyYv5qtzsNACeOoCH
sBUmQ67xWzjrSMB27o149i4=
=hGvN
-----END PGP SIGNATURE-----

Reply via email to