scope guards

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Tue Aug 5 09:30:43 PDT 2014


On 2014-08-05 12:38, Manu via Digitalmars-d wrote:

> 'scope' class destruction is deterministic though right?
>
> http://dlang.org/statement.html : there are examples of stuff like this:
>
> scope  Foo f =new  Foo();

Yes, but you don't know in the destructor of "Foo" if it was used in a 
scope declaration like above or not, unless you declare the whole class 
as "scope". BTW, Tango in D1 solved this by introducing Object.dispose 
which was called then "scope" or "delete" was used.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list