GC has a "barbaric" destroyng model, I think

via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Feb 12 04:24:37 PST 2015


On Thursday, 12 February 2015 at 11:11:53 UTC, ponce wrote:
> On Thursday, 12 February 2015 at 10:24:38 UTC, Mike Parker 
> wrote:
>> On 2/12/2015 6:09 PM, weaselcat wrote:
>>> On Thursday, 12 February 2015 at 08:33:35 UTC, Kagamin wrote:
>>>> Truth be told, D has no guideline for deterministic 
>>>> destruction of
>>>> managed resources.
>>>
>>> +1
>>>
>>> don't complain about people wondering why class destructors 
>>> don't work
>>> when there's no _real_ way to do it in D beyond 'drop down to 
>>> C level
>>> and get going.' D is absolutely horrid for resource 
>>> management.
>>
>> I'm not complaining. I'm simply suggesting that the very word 
>> "destructor" likely plays a role in the misconception that 
>> class destructors behave as they do in C++. However, I do 
>> think that when moving from one language to another, there has 
>> to be a certain expectation that things are going to be 
>> different and it shouldn't be a surprise when they are.
>
> What I think is that the GC should simply never call the 
> destructors.
> The GC calling class destructors is currently a 50% solution 
> that provide illusory correctness.

s/class destructors/any destructors/

It now calls struct destructors, too, IIRC, at least when the 
structs are in GC managed arrays.


More information about the Digitalmars-d-learn mailing list