[Semi OT] Language for Game Development talk
deadalnix via Digitalmars-d
digitalmars-d at puremagic.com
Sun Sep 28 00:12:30 PDT 2014
On Saturday, 27 September 2014 at 10:01:05 UTC, Ola Fosheim
Grøstad wrote:
> On Friday, 26 September 2014 at 21:19:29 UTC, Walter Bright
> wrote:
>> I would. The whole point of destructors is to automatically
>> clean up resources when the object goes away, which was
>> (later) dubbed RAII.
>
> Yeah, but RAII takes it to the extreme where you create dummy
> classes that only consist of constructors/destructors so that
> the stack unwinding does all cleanup/closing/freeing without
> any try/catch.
>
This is not necessary in D as we have scope statements.
> Before C++ templates that looked verbose and ugly
> syntactically, and it is still tedious if you only use the
> specific resource in one location. "scope(exit)" is often more
> transparent IMO.
I guess this is matter of style and various tradeoff. A very
common operation to rollback probably deserve its own RAII
struct. An uncommon one is better served with scope.
More information about the Digitalmars-d
mailing list