TDPL: Manual invocation of destructor
Max Samukha
spambox at d-coding.com
Tue Aug 10 07:29:49 PDT 2010
On 08/10/2010 06:22 AM, Andrei Alexandrescu wrote:
> Michel Fortin wrote:
>> On 2010-08-09 21:20:31 -0400, Andrei Alexandrescu
>> <SeeWebsiteForEmail at erdani.org> said:
>>
>>> clear() would not subvert the type system.
>>
>> Oh sure it does!
>>
>> 1. You acknowledged yourself one of my argument a few days ago that if
>> the class has an immutable member it'll be wiped out. Someone else
>> somewhere could have a reference to that member, and it's value will
>> change which could cause bad things...
>
> I forgot that argument again :o). I acknowledge being destroyed (which
> is strictly worse than cleared...)
>
Is that argument valid? An immutable non-static member is still part of
the object state. You shouldn't expect references to the object state
remain valid after the object has been destroyed.
More information about the Digitalmars-d
mailing list