Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21288 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95557 invoked by uid 1010); 20 Dec 2005 16:59:35 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 95542 invoked from network); 20 Dec 2005 16:59:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Dec 2005 16:59:35 -0000 X-Host-Fingerprint: 194.109.193.120 unknown Linux 2.4/2.6 Received: from ([194.109.193.120:36487] helo=mx1.moulin.nl) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 79/5D-14561-77838A34 for ; Tue, 20 Dec 2005 11:59:35 -0500 Received: from localhost (localhost [127.0.0.1]) by mx1.moulin.nl (Postfix) with ESMTP id EEC961932D3; Tue, 20 Dec 2005 17:59:36 +0100 (CET) Received: from mx1.moulin.nl ([127.0.0.1]) by localhost (moulin [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 15504-09; Tue, 20 Dec 2005 17:59:35 +0100 (CET) Received: from [192.168.1.16] (bspr.xs4all.nl [194.109.161.228]) by mx1.moulin.nl (Postfix) with ESMTP id 7D76C189B49; Tue, 20 Dec 2005 17:59:35 +0100 (CET) Message-ID: <43A83871.9070903@iamjochem.com> Date: Tue, 20 Dec 2005 17:59:29 +0100 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Alan Pinstein Cc: scuzzy@reverseorder.net, Marcus Boerger , PHP References: <20051216141608.M76819@reverseorder.net> <124842700.20051216203820@marcus-boerger.de> <20051219100552.M48206@reverseorder.net> <1649362906.20051219201607@marcus-boerger.de> <20051220134857.M91845@reverseorder.net> <6E2D0033-4F34-42D2-9C2B-EF59C62B83B6@mac.com> In-Reply-To: <6E2D0033-4F34-42D2-9C2B-EF59C62B83B6@mac.com> X-Enigmail-Version: 0.89.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: amavisd-new at moulin.nl Subject: Re: [PHP-DEV] exceptions in the destructor From: jochem@iamjochem.com (Jochem Maas) Alan Pinstein wrote: >> Your last post also indicates, that because the destructors are only >> called >> after script termination, the scope of an object is global, always. >> Is this true? > > > This isn't true, at least empirically. Destructors are called when the > GC frees the object. > > For many objects, this is at script termination. But if you null out > the ref to an object, it will occur immediately. > > $a = new A(); > $a = null; // destructor called just after this line > > I am not certain that this should be considered *predictable* behavior, > as the behavior of the GC is not well/publicly documented to my > knowledge, and thus this is a reasonable question for the internals list. > > Personally I would like to see more documentation of how GC works so > that we as developers can depend on it a little better for OO cleanup > activities. I have another thread going that still remains unanswered > about how to prevent circular references to objects that deadlock the GC. I feel the usefulness of the dtors is undermined even more by the 'chiken/egg' problem regarding which comes first 'shutdown' or 'running the dtors'; I don't claim to have a solution or even understand the problem fully but it does seem to me that for most of the things an average developer would think of using object dtors for, the mechanism is unusable; and from what I understand the 'chicken/egg' problem I mentioned has been an ongoing PITA for devs! (IIRC Wez mentioned the to-ing and fro-ing regarding this not so long ago) Phorce be with you. (excuse me, but I have just had my annual starwars fix :-) > > Alan >