<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 5 August 2014 19:37, Atila Neves via Digitalmars-d <span dir="ltr"><<a href="mailto:digitalmars-d@puremagic.com" target="_blank">digitalmars-d@puremagic.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class=""><div class="h5">On Monday, 4 August 2014 at 14:57:44 UTC, Dicebot wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On Monday, 4 August 2014 at 04:09:07 UTC, Manu via Digitalmars-d wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Sure, scope() may be useful for this, but it seems in my experience that<br>
destructors almost always perform this without any additional code at the<br>
callsite.<br>
</blockquote>
<br>
Destructors only work if:<br>
<br>
a) you already have RAII wrappers provided, otherwise it is much more code to write<br>
b) you work with structs, class destruction is non-determenistic<br>
</blockquote>
<br></div></div>
b) And even then, struct destruction can be non-deterministic if they happen to be in a dynamic array...<br>
</blockquote></div><br></div><div class="gmail_extra">'scope' class destruction is deterministic though right?</div><div class="gmail_extra"><br></div><div class="gmail_extra"><a href="http://dlang.org/statement.html">http://dlang.org/statement.html</a> : there are examples of stuff like this:<br>
</div><div class="gmail_extra"><pre class="" style="padding:1ex;margin-left:0em;font-size:13.63636302947998px;border:1px solid rgb(204,204,204);width:auto;white-space:pre-wrap;word-wrap:break-word;color:rgb(0,0,102);text-align:justify;background:rgb(252,252,252)">
<span class=""><span class="" style="color:blue">scope</span> Foo f = <span class="" style="color:blue">new</span> Foo();</span></pre></div></div>