Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41338 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71262 invoked from network); 23 Oct 2008 10:34:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Oct 2008 10:34:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=helly@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=helly@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 85.214.94.56 as permitted sender) X-PHP-List-Original-Sender: helly@php.net X-Host-Fingerprint: 85.214.94.56 aixcept.net Linux 2.6 Received: from [85.214.94.56] ([85.214.94.56:56973] helo=h1149922.serverkompetenz.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/75-44135-94350094 for ; Thu, 23 Oct 2008 06:34:51 -0400 Received: from MBOERGER-ZRH.corp.google.com (123-76.107-92.cust.bluewin.ch [92.107.76.123]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by h1149922.serverkompetenz.net (Postfix) with ESMTP id 0D05911F7D2; Thu, 23 Oct 2008 12:34:37 +0200 (CEST) Date: Thu, 23 Oct 2008 12:31:47 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <1169741147.20081023123147@marcus-boerger.de> To: Ryan Panning CC: internals@lists.php.net In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Destructor Order From: helly@php.net (Marcus Boerger) 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