How to write a proper class destructor?
kris
foo at bar.com
Thu Jan 25 13:04:41 PST 2007
Bradley Smith wrote:
> kris wrote:
>
>> Bradley Smith wrote:
>>
>>> According to the documentation, a class destructor is "expected to
>>> release any resources held by the object."[1] However, if resources
>>> to be released are in objects to be garbage collected, "those
>>> references are no longer valid."[1]
>>>
>>> How is a class supposed to release something for which it no longer
>>> has a valid reference?
>>>
>>>
>>> Bradley
>>>
>>>
>>>
>>> [1] http://www.digitalmars.com/d/class.html#destructors.
>>
>>
>> Yeah, that's a good one :)
>>
>> Tango has a good resolution for this, that stemmed from long
>> discussion on the NG. Those changes never made it into phobos, IIRC
>
>
> Isn't the destructor behavior dictated by the language? How can it be
> fixed with a library? Replace or bypass the GC?
Aye -- tango has a modified GC with all kinds of goodies.
More information about the Digitalmars-d-learn
mailing list