Tuesday 13 July 2010

Controversy regarding memory management in D

D 2 is subject to constant redesign and improvement. Or is it? It appears that D is becoming, like C++, a language designed by comitee. With a big difference: at least when C++ is changed, both the relevance of the changes and the impact on the language features are carefully considered.

So, what is happening to D? Well, somebody thought to themselves “This delete keyword is a source of a multitude of errors” and from there decided that it should be banned! Not without a replacement of course. There is a proposal for new functions that would effectively replace the delete keyword. One of them is clear(object), which would destroy the object, copy onto it the initial value Object.init, and construct it again. It sounds more like a reset(object) to me… Another one is a function that does nothing other than destroy the object, which is what delete already does. It seems that the idea is to encourage people to always use the garbage collector and disencourage people from managing the memory manually…

There already is a language with such a logic, it’s called Java. I refuse to allow the prejudices of a minority to turn the powerful and flexible systems language that is D into a mere Java copycat. Naturally, we must find a middleground, and so far, the best counter-proposal is to keep the delete keyword, but forbid it in the SafeD subset. It sounds like the most logical alternative to me.

What do you think? Leave your vote in the poll.

No comments:

Post a Comment