Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51428 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34160 invoked from network); 4 Feb 2011 04:53:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2011 04:53:18 -0000 Authentication-Results: pb1.pair.com header.from=rasmus@lerdorf.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=rasmus@lerdorf.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lerdorf.com from 209.85.214.170 cause and error) X-PHP-List-Original-Sender: rasmus@lerdorf.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:56279] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id AE/52-21221-D368B4D4 for ; Thu, 03 Feb 2011 23:53:18 -0500 Received: by iwn6 with SMTP id 6so1935373iwn.29 for ; Thu, 03 Feb 2011 20:53:15 -0800 (PST) Received: by 10.42.218.200 with SMTP id hr8mr13786861icb.219.1296795195371; Thu, 03 Feb 2011 20:53:15 -0800 (PST) Received: from Anonymous.local (c-98-234-184-167.hsd1.ca.comcast.net [98.234.184.167]) by mx.google.com with ESMTPS id ca7sm223831icb.12.2011.02.03.20.53.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 03 Feb 2011 20:53:13 -0800 (PST) Message-ID: <4D4B8637.2000807@lerdorf.com> Date: Thu, 03 Feb 2011 20:53:11 -0800 User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.13) Gecko/20101207 Lightning/1.0b2 Thunderbird/3.1.7 MIME-Version: 1.0 To: Chris Stockton CC: Ben Schmidt , PHP Developers Mailing List References: <4D4B82DD.9040209@yahoo.com.au> In-Reply-To: X-Enigmail-Version: 1.1.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] A quick consensus on magic method idea From: rasmus@lerdorf.com (Rasmus Lerdorf) On 2/3/11 8:49 PM, Chris Stockton wrote: > Hello, > > On Thu, Feb 3, 2011 at 8:38 PM, Ben Schmidt > wrote: >> >> Do you yourself have any situation where this is useful? Does it solve >> some problem? Does it enable you to do things better than before? >> >> Ben. >> > > It does not provide a solution to a currently unsolvable problem, it > is simply a convenience for situations when you want a class to > perform any kind of initialization directly after compilation/loading > (whatever term you find easier on the ears). This creates problems for opcode caches since the classes are all precompiled and usually optimized to the point where the opcodes that loads them are NOP'ed away and you just have the full class table cached in memory for each op_array. Walking through that class table on every request and looking for these magic methods to call would be quite annoying, especially since most of them wouldn't have such a method to begin with. -Rasmus