On Wed, Oct 22, 2008 at 5:03 AM, Ryan Panning <[EMAIL PROTECTED]> 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


Why would you need such thing?
PHP uses reference-counting and destroys objects as soon, as there are
no more references to them. Since PHP 5.3, it also detects
cyclic-references and periodically destroys object-groups which have
references to each other, but do not have references from external
context.


-- 
Alexey Zakhlestin
http://blog.milkfarmsoft.com/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to