logoalt Hacker News

gregdaniels421today at 2:31 AM1 replyview on HN

> I would classify D's scope exit/failure/success as RAII actually, even if D uses a GC.

It has better than that, but it is a bit clunky compared with C++(just use struct instead of class). You can have proper destructors, but if you have a container you need to be more careful than in C++.

In D exceptions are the default like in C++ and you have to opt out with nothrow or extern(C) or betterC.

Really try some D code in a bigger situation it is 90% good and almost worth using over C++, but if you can't have GC it is a huge pain, but better than C.


Replies

WalterBrighttoday at 4:19 AM

I've never understood why GC would be a huge pain. It makes some things a lot easier, like Compile Time Function Execution.

Also, recently the GC implementation received a big modernization upgrade.