~= call copy ctor?
monarch_dodra
monarchdodra at gmail.com
Sun Jul 22 11:45:05 PDT 2012
On Sunday, 22 July 2012 at 18:14:21 UTC, Namespace wrote:
> On Sunday, 22 July 2012 at 17:41:33 UTC, Ali Çehreli wrote:
>> On 07/22/2012 09:27 AM, Mafi wrote:
>>
>> >> Unfortunately it has a bad name, which is going to be
>> changed.
>>
>> > Really? I thought we have to stay with this name now. In my
>> > opinion this name is quite bad, especially in the presence of
>> > UFCS. What is going to be changed to? destroy()?
>>
>> Yep! :) It should be available in 2.060:
>>
>> // Scheduled for deprecation in December 2012.
>> // Please use destroy instead of clear.
>>
>> https://github.com/D-Programming-Language/druntime/blob/master/src/object.di#L682
>>
>> Ali
>
> And how do I check if my object is still valid?
AFAIK, there are no invalid objects in D*. structs don't have
default constructors, because they all have a compile time "init"
value which they are filled with when
"emptied"/"moved"/"cleared". Ergo, even after being "destroyed",
they are still valid.
Arrays are set to a null slice.
Pointers and class references are set to null.
To check a class reference, then "if(instance is null)" should do
what you want BTW.
*Provided you don't go out of your way to give them an invalid
state, of course.
More information about the Digitalmars-d-learn
mailing list