Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:66708 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19163 invoked from network); 19 Mar 2013 20:43:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Mar 2013 20:43:13 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:48926] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/C1-07534-FDDC8415 for ; Tue, 19 Mar 2013 15:43:12 -0500 Received: from transformer.fritz.box (ppp-93-104-25-27.dynamic.mnet-online.de [93.104.25.27]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 48EB965170; Tue, 19 Mar 2013 21:43:07 +0100 (CET) User-Agent: K-9 Mail for Android In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: Tue, 19 Mar 2013 21:43:03 +0100 To: =?UTF-8?Q?Mat=C4=ABss_Roberts_Treinis?= ,PHP Development Message-ID: <5f39c9e5-14c7-4403-ab95-bd898b748e6a@email.android.com> Subject: Re: [PHP-DEV] Proposal: new magic methods for Object references. From: johannes@schlueters.de (=?ISO-8859-1?Q?Johannes_Schl=FCter?=) "Matīss Roberts Treinis" wrote: >Proposal: > >Two additional magic methods for PHP objects - > >__refer(void): > >Refer method is called whenever object's identifier is assigned to >variable, if such method is present. >Example: > >$foo = new Bar; >$bar = $foo; //__refer invoked This assignment is handled using PHP's copy on write mechanism for any variable. A change here has massive impact on any variable assignment, function parameter passing, ... and tons of internal places. What we have is a hook for the objects own reference counting which is affected when an object refering to an object is used in write-context by the engine, that might easily be exteded but is rather useless. (It's trivial to create an interface or abstract base class providing this addref/delref info) Unless you can provide a robust good patch without performance penalty in cases where this isn't used this will lead nowhere, and I doubt there is a way to come up with that. (rewriting the engine might be the closest approach) johannes