Comment Re:High performance of C++ equal to D??? (Score 1) 404
Second of all, calling destructors on a modern GC are extremely costly. Sure, your example implementation of destructors seems simple, but it is only possible in a reference counted garbage collector, which is so primitive as to be nearly useless.
This may be true if you want deterministic finalization, but not if you want dtor support in general. The D garbage collector is a typical mark & sweep GC and incurs no overhead for finalizing objects before the memory is freed.
It's another issue entirely whether dtor support is desirable in a GCed language. First of all, there's the weird restriction of not being able to use any references to GCed memory, because that data may already have been collected by the GC. Then there's the issue that collection is not deterministic. Some have suggested that dtors should only be allowed for "scope" objects, so RAII is supported without the false sense of security that dtors might provide for GCed data, but I think a fair argument could be made either way. Personally, I find dtors to be useful in a GCed language, if only as an insurance policy.
By the way, I believe that C++/CLI (ie. C++ for