Recommended way to do RAII cleanly

Nick Sabalausky a at a.a
Mon Jul 12 18:15:04 PDT 2010


"torhu" <no at spam.invalid> wrote in message 
news:i1ft84$2h4j$1 at digitalmars.com...
>
> I think the conclusion is that RAII is less important in D than in C++. In 
> D you use scope (exit), or even finally, like in Java or Python. The other 
> use of scope, as a storage class, is supposed to go away, and I suspect 
> I'm not the only one who's going to miss it.

As good as scope guards are, anytime you have an object that has some sort 
of cleanup function that needs to be called when you're done with it, it's 
absurd to think that requiring the *user* of the object to use scope guards 
*by convention* is ever a satisfactory substitute for real RAII.

And I have to say, I'm rather disappointed to hear that scope objects are 
going away. What is the reason for that? 




More information about the Digitalmars-d-learn mailing list