Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:41313 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80510 invoked from network); 22 Oct 2008 06:00:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Oct 2008 06:00:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=indeyets@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=indeyets@gmail.com; sender-id=pass; domainkeys=bad Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.198.229 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: indeyets@gmail.com X-Host-Fingerprint: 209.85.198.229 rv-out-0506.google.com Received: from [209.85.198.229] ([209.85.198.229:55535] helo=rv-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8D/12-62149-281CEF84 for ; Wed, 22 Oct 2008 02:00:35 -0400 Received: by rv-out-0506.google.com with SMTP id g37so3080142rvb.23 for ; Tue, 21 Oct 2008 23:00:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=Cb5BeVvrciyA/ya9Elo4hfk6J3LvGrilApJTSnGYSF8=; b=hD1vyBVCZ/oDr4gyOvwDIPPS3Gcg7MwkmJl61IGx/HjyfeYnPjYuae9mUsAD4ym+Lc zV1/076xZHtsVB4Ci6ec0dq1wrglhNMM2xa2inONhCwWERXUD8U1/NMLFaj0TBiX/+jC ZID1Cpw5d9rKGfGxBifljhiS5nTWhtaSpPbQQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=Z65TwejYVZIvNd5JRRPzC4fTGcm1SLhvoE6n+eKBlLiOroWCRLkKzgrMl034aMpWTP wLEbsFUM/h8C0bEd1igqzImY6e1lsSXNnSZrR1CuKQIxl2stfiwJbgnv608vWzgUFmoM YT4AdxB6YU8XhdOOCKdeFY3W4XBmH4Jj7F0Pc= Received: by 10.141.48.6 with SMTP id a6mr6173050rvk.236.1224655232169; Tue, 21 Oct 2008 23:00:32 -0700 (PDT) Received: by 10.140.133.15 with HTTP; Tue, 21 Oct 2008 23:00:32 -0700 (PDT) Message-ID: Date: Wed, 22 Oct 2008 10:00:32 +0400 To: "Ryan Panning" Cc: internals@lists.php.net In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: Subject: Re: [PHP-DEV] Destructor Order From: indeyets@gmail.com ("Alexey Zakhlestin") On Wed, Oct 22, 2008 at 5:03 AM, Ryan Panning 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/