May 26, 2012
On Saturday, May 26, 2012 04:34:30 Mehrdad wrote:
> Okay, thanks for the explanation.
> 
> So basically, clear() just calls __dtor(), and then zeros out the
> vtable?

Yes, though it calls rt_finalize on classes rather than dtor directly, so that may do some extra stuff beyond strictly calling __dtor and zeroing out the vtable.

> I don't understand what you mean by "I don't believe that it destroys what the object references"... why should clear() ever destroy anything except the object that it's destroying?

Normally when an object is destroyed, all of its member variables' destructors would be called as well (at least for member variables which are structs or arrays of structs - member variables which are classes aren't finalized). But the destructor itself doesn't call all of the member variables' destructors, so calling __dtor doesn't call them. You have to do something else to get the member variables destroyed as well (something with typeid I think, but I don't remember the details).

- Jonathan M Davis
May 26, 2012
On 5/25/12 7:30 PM, Mehrdad wrote:
> On Friday, 25 May 2012 at 20:41:10 UTC, John Chapman wrote:
>> On Friday, 25 May 2012 at 20:16:32 UTC, Brad Anderson wrote:
>>> On Fri, May 25, 2012 at 1:34 PM, sclytrack <sclytrack@iq87.fr>
>>>> blank, destroy, trash, dump, zero, bleach, cleanup,
>>>> sanitize, burn, nuke, eject, jetisson, discard,
>>>> landfill, waste, litter, debris, recycle, obliterate,
>>>> annihilate, eradicate, expunge, finish, ravage, wipe,
>>>> zap, abolish, decimate, demolish, massacre, murder,
>>>> ruin, slaughter, quash, scrub, splat
>>>>
>>>>
>>>>
>>> I'm partial to defenestrate().
>>
>> One for the Doctor Who fans among us:
>>
>> exterminate().
>
> or we could just, uh, bring back delete...

delete also deallocates.

Andrei
May 26, 2012
> I take it back, dispose is no good.  That should be the name of the deterministic destructor in the object.
>
> Now I don't have a good name.  Finalize isn't right, and neither is dispose...
>
> -Steve

disembowel?
May 26, 2012
On Saturday, 26 May 2012 at 02:46:57 UTC, Jonathan M Davis wrote:
> Normally when an object is destroyed, all of its member variables' destructors would be called as well (at least for member variables which are structs or arrays of structs - member variables which are classes aren't finalized)



Ahh, that was what confused me, thanks... I thought you were referring to member /Object/s.
May 26, 2012
Why not just call it 'destroy()'?
May 26, 2012
On Saturday, 26 May 2012 at 03:21:31 UTC, Mehrdad wrote:
> Why not just call it 'destroy()'?

+1
May 26, 2012
On 05/26/2012 06:58 AM, jerro wrote:
> On Saturday, 26 May 2012 at 03:21:31 UTC, Mehrdad wrote:
>> Why not just call it 'destroy()'?
>
> +1

+1

And as a bonus all the Delphi dudes will feel right at home.

May 26, 2012
On 5/25/12 22:42 , Steven Schveighoffer wrote:
> Finalize isn't right, and neither is dispose...

In Java it's finalize:

http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html#finalize()

In Ruby it's define_finalizer:

http://www.ruby-doc.org/core-1.9.3/ObjectSpace.html#method-c-define_finalizer

Why not calling finalize then? A bonus is that programmers coming from those languages will find the name more intuitive.
May 26, 2012
On 25.05.2012 23:34, sclytrack wrote:

>
> blank, destroy, trash, dump, zero, bleach, cleanup,
> sanitize, burn, nuke, eject, jetisson, discard,
> landfill, waste, litter, debris, recycle, obliterate,
> annihilate, eradicate, expunge, finish, ravage, wipe,
> zap, abolish, decimate, demolish, massacre, murder,
> ruin, slaughter, quash, scrub, splat
>
>
I like wipe though obliterate is so much clearer ... :)

-- 
Dmitry Olshansky
May 26, 2012
On Saturday, 26 May 2012 at 06:06:08 UTC, sclytrack wrote:
> On 05/26/2012 06:58 AM, jerro wrote:
>> On Saturday, 26 May 2012 at 03:21:31 UTC, Mehrdad wrote:
>>> Why not just call it 'destroy()'?
>>
>> +1
>
> +1

+1