Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51431 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8628 invoked from network); 7 Feb 2011 15:39:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Feb 2011 15:39:37 -0000 Authentication-Results: pb1.pair.com header.from=sv_forums@fmethod.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sv_forums@fmethod.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fmethod.com from 209.85.215.170 cause and error) X-PHP-List-Original-Sender: sv_forums@fmethod.com X-Host-Fingerprint: 209.85.215.170 mail-ey0-f170.google.com Received: from [209.85.215.170] ([209.85.215.170:62318] helo=mail-ey0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 77/50-06586-832105D4 for ; Mon, 07 Feb 2011 10:39:37 -0500 Received: by eyf5 with SMTP id 5so2198096eyf.29 for ; Mon, 07 Feb 2011 07:39:33 -0800 (PST) Received: by 10.213.29.193 with SMTP id r1mr467749ebc.3.1297093173538; Mon, 07 Feb 2011 07:39:33 -0800 (PST) Received: from pc ([83.228.56.37]) by mx.google.com with ESMTPS id t50sm3205036eeh.18.2011.02.07.07.39.30 (version=SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 07:39:31 -0800 (PST) Message-ID: <129B11E6393E43AA846265F1C2D2EAC9@pc> To: "Rasmus Lerdorf" , "Chris Stockton" Cc: "Ben Schmidt" , "PHP Developers Mailing List" References: <4D4B82DD.9040209@yahoo.com.au> <4D4B8637.2000807@lerdorf.com> Date: Mon, 7 Feb 2011 17:39:26 +0200 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 Subject: Re: [PHP-DEV] A quick consensus on magic method idea From: sv_forums@fmethod.com ("Stan Vass") > 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 > As a class is added to the table (on first execute of the opcodes) it can check at that point if the magic method exists, and put it in a separate compact list to call for every request. Walking all classes repeatedly is thus avoided. However, a remaining problem is the user no longer controls when exactly are his classes initialized, and in what concrete order. We have the potential for race conditions, where classes B, and C rely on initialized class A, or on some other initialization routine called in userland, which has not been executed yet, producing "sometimes broken" code that's hard to debug. Stan Vass