RAII limitations in D?

Russel Winder via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Aug 22 10:37:20 PDT 2014


On Thu, 2014-08-21 at 19:22 -0700, Timothee Cour via Digitalmars-d-learn
wrote:
> What would be a good answer to this article?
> http://swiftcoder.wordpress.com/2009/02/18/raii-why-is-it-unique-to-c/
> 
> Especially the part mentioning D:{
> D’s scope keyword, Python’s with statement and C#’s using declaration all
> provide limited RAII, by allowing resources to have a scoped lifetime, but
> none of them readily or cleanly support the clever tricks allowed by C++’s
> combination of smart pointers and RAII, such as returning handles from
> functions, multiple handles in the same scope, or handles held by multiple
> clients.
> }

The author has clearly not actually used Python. There is nothing that C
++ can do with RAII that you cannot do with Python/context managers/with
statement. Nothing.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d-learn mailing list