Linus with some good observations on garbage collection

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sat Apr 23 10:13:06 PDT 2011


On 4/23/11 11:33 AM, Timon Gehr wrote:
>> On 4/22/11 4:04 PM, Timon Gehr wrote:
>> [snip]
>>> This is also the reason I think it is a bad idea to deprecate D's
>>> 'delete'.
>>
>> The functionality is not going away.
>>
>> Andrei
>
> Yes I realize that. It is a matter of syntax and aesthetics. Handling allocation
> and deallocation non-uniformly renders the language ugly (or are you considering
> to remove the 'new' keyword too?).

Allocation and deallocation are not symmetric and as such handling them 
in a uniform way would be a mistake that perpetuates a poor 
understanding of the underlying realities of memory allocation and 
object creation. I suggest you reconsider.

> And it discourages people to get informed about
> custom allocators etc.

I don't see the relationship here.

> I mean, how will custom allocators look like? The cost of
> having the delete keyword in the language is low. Before removing that, why not
> consider the 'body' keyword instead?

The cost of keeping "delete" in the language is making a rarely-used, 
dangerous facility with loosely-defined semantics straight inside the 
language. It reflects poor language design for many reasons.


Andrei



More information about the Digitalmars-d mailing list