I thought __dtor() does everything needed. Seems like I was mistaken? Sean, how do I call rt_finalize?

Andrei

Sean Kelly wrote:
Why not just call rt_finalize? How an object is finalized may vary by compiler.
Sent from my iPhone

On Jul 23, 2010, at 2:17 AM, Max Samukha <[email protected]> wrote:

The implementation is still incomplete. It doesn't call base class dtors. This 
unittest should pass:

unittest
{
    class A { static bool dead; ~this() { dead = true; } }
    class B : A { static bool dead; ~this() { dead = true; } }
    {
        auto b = scoped!B;
    }
    assert(B.dead);
    assert(A.dead);
}

A less severe problem is that it doesn't delete the object's monitor if one was 
allocated.

Please refer to rt_finalize for correct destruction sequence. Essentially, 
Scoped dtor should do what rt_finalize does except there is no need to catch 
destructor exceptions and I'm not sure about collectHandler. Sean, please 
comment?
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos
_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to