Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49643 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79459 invoked from network); 13 Sep 2010 21:53:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2010 21:53:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.22 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.22 smtp2.ist.utl.pt Linux 2.6 Received: from [193.136.128.22] ([193.136.128.22:42794] helo=smtp2.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/90-24501-14D9E8C4 for ; Mon, 13 Sep 2010 17:53:06 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp2.ist.utl.pt (Postfix) with ESMTP id BBDD17000452 for ; Mon, 13 Sep 2010 22:53:02 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp2.ist.utl.pt ([127.0.0.1]) by localhost (smtp2.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id s1XA6iNlB3S9 for ; Mon, 13 Sep 2010 22:53:02 +0100 (WEST) Received: from mail2.ist.utl.pt (mail2.ist.utl.pt [IPv6:2001:690:2100:1::c]) by smtp2.ist.utl.pt (Postfix) with ESMTP id 825D7700044E for ; Mon, 13 Sep 2010 22:53:02 +0100 (WEST) Received: from cataphract-old.dulce.lo.geleia.net (a79-168-249-157.cpe.netcabo.pt [79.168.249.157]) (Authenticated sender: ist155741) by mail2.ist.utl.pt (Postfix) with ESMTPSA id 50F442003FBE for ; Mon, 13 Sep 2010 22:53:02 +0100 (WEST) Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: internals@lists.php.net References: <4C879613.7090709@zend.com> <4C887D2B.2000605@zend.com> <4C8AC526.7000505@sugarcrm.com> <4C8B6168.30504@mohiva.com> <4C8BC81E.8000605@sugarcrm.com> <7.0.1.0.2.20100913145703.0d226d90@zend.com> <7.0.1.0.2.20100913172559.0d2277d0@zend.com> <7.0.1.0.2.20100913183427.0d2277d0@zend.com> <4C8E6B6F.4080308@sugarcrm.com> <4C8E8ED4.9040502@sugarcrm.com> Date: Mon, 13 Sep 2010 22:53:13 +0100 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Organization: =?iso-8859-15?Q?N=FAcleo_de_Eng=2E_Biom=E9dica_?= =?iso-8859-15?Q?do_IST?= Message-ID: In-Reply-To: <4C8E8ED4.9040502@sugarcrm.com> User-Agent: Opera Mail/10.61 (Win32) Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: glopes@nebm.ist.utl.pt ("Gustavo Lopes") On Mon, 13 Sep 2010 21:51:32 +0100, Stas Malyshev wrote: >> If I'm not mistaken, the current implementation instantiates an object >> each time getAnnotation() is called, but it was proposed to change this >> into a lazy-loading mechanism with the same instance returned every time >> for each annotation. In that case, we'd only need to validate that one >> time. (What I describe as "proposed" is actually the implemented behavior) > > Object instances can't be bytecode-cached, so when are they > instantiated? Does it mean it's stateful and mutable? You're confusing multiple calls to the script to multiple calls to getAnnotation(). You're right in that one cannot keep objects between requests. The annotation will have to be regenerated, and possibly validated, on each script call. It's indeed unfortunate, but we could add the possibility of turning off these verifications in production or add a hook that extensions could use so they could cache the result of the validation. It's not a show-stopper. However, this does not equal instantiations for each call to getAnnotation(). This only creates one object: class A extends ReflectionAnnotation {} [A] class H { } $refH = new ReflectionClass("H"); $refH->getAnnotations(); $refH->getAnnotations(); -- Gustavo Lopes