Re: Destructor Order

From: Date: Thu, 23 Oct 2008 10:31:47 +0000
Subject: Re: Destructor Order
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-41338@lists.php.net to get a copy of this message
Hello Ryan, during 5.0 alpha phase I had that actually implemented. But it turned out to be too much of a slowdown and also could not solve all dependency graphs. For example you can obviously not solve dependency cycles. So at the end of the experiement we decided against it. Maybe we could implement a function that triggers ordered shutdown, so that the user has the choice of doing it as good as possible. marcus Wednesday, October 22, 2008, 3:03:18 AM, you wrote: > I've been wondering, is such a thing even possible? Is there a good way > to implement an object destruct order? Here are my thoughts: > In the class definition, specify what "level" of destruction the objects > should be on. How, I have no idea, I haven't thought of a good syntax. > It should be an integer for what level though. > Then when the script ends, the engine starts with the highest most level > of destruction. It continues down until everything has been destructed. > With the last most level being objects with unspecified levels. > Note: Each level can have more than one class. > Example destruction order: > 3 = database records (ActiveRecord or such) > 2 = database connection object > 1 = framework objects > 0 = objects with unspecified level Best regards, Marcus

« previous php.internals (#41338) next »