On 5 August 2014 19:37, Atila Neves via Digitalmars-d < [email protected]> wrote:
> On Monday, 4 August 2014 at 14:57:44 UTC, Dicebot wrote: > >> On Monday, 4 August 2014 at 04:09:07 UTC, Manu via Digitalmars-d wrote: >> >>> Sure, scope() may be useful for this, but it seems in my experience that >>> destructors almost always perform this without any additional code at the >>> callsite. >>> >> >> Destructors only work if: >> >> a) you already have RAII wrappers provided, otherwise it is much more >> code to write >> b) you work with structs, class destruction is non-determenistic >> > > b) And even then, struct destruction can be non-deterministic if they > happen to be in a dynamic array... > 'scope' class destruction is deterministic though right? http://dlang.org/statement.html : there are examples of stuff like this: scope Foo f = new Foo();
