Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:16198 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93315 invoked by uid 1010); 10 May 2005 14:46:25 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 63570 invoked from network); 10 May 2005 14:26:06 -0000 Received: from unknown (HELO php.net) (127.0.0.1) by localhost with SMTP; 10 May 2005 14:26:06 -0000 X-Host-Fingerprint: 212.112.227.169 ipx11223.ipxserver.de Linux 2.4/2.6 Received: from ([212.112.227.169:36041] helo=ipx11223.ipxserver.de) by pb1.pair.com (ecelerity 1.2 r(5656M)) with SMTP id D6/C2-35155-E74C0824 for ; Tue, 10 May 2005 10:26:06 -0400 Received: from localhost (localhost [127.0.0.1]) by ipx11223.ipxserver.de (Postfix) with ESMTP id 2D8FDDF0155; Tue, 10 May 2005 16:26:31 +0200 (CEST) Received: from ipx11223.ipxserver.de ([127.0.0.1]) by localhost (ipx11223 [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 30257-04; Tue, 10 May 2005 16:26:28 +0200 (CEST) Received: from [192.168.0.101] (user-0cal1oq.cable.mindspring.com [24.170.135.26]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ipx11223.ipxserver.de (Postfix) with ESMTP id 06A9ADF0121; Tue, 10 May 2005 16:26:28 +0200 (CEST) Message-ID: <4280C47B.2070507@php.net> Date: Tue, 10 May 2005 10:26:03 -0400 User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: lpedretti@suserver.com Cc: Rory Browne , internals@lists.php.net References: <200505091130.56300.lpedretti@suserver.com> <427FA7A5.6050803@iamjochem.com> <200505101046.19099.lpedretti@suserver.com> In-Reply-To: <200505101046.19099.lpedretti@suserver.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by somedaemon at backendmedia.com Subject: Re: [PHP] Re: [PHP-DEV] make new return a reference to existent object From: lsmith@php.net (Lukas Smith) Leonardo Pedretti wrote: > It would not be such a problem to write something that does the same task > through a static or global function, but unfortunately it is impossible, due > to the following: you can build a cache in an array, then in a __new() > function you could check if the requested object is already loaded and return > a reference. However, if this is the case, objects that enter the cache never > leave it because they are still referenced in the array when all other > references have gone, so they never destruct, except when the array is > destroyed at program's end. PHP5 has destructors ... regards, Lukas