Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49641 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 63767 invoked from network); 13 Sep 2010 20:34:14 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2010 20:34:14 -0000 Authentication-Results: pb1.pair.com header.from=glopes@nebm.ist.utl.pt; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=glopes@nebm.ist.utl.pt; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain nebm.ist.utl.pt from 193.136.128.21 cause and error) X-PHP-List-Original-Sender: glopes@nebm.ist.utl.pt X-Host-Fingerprint: 193.136.128.21 smtp1.ist.utl.pt Linux 2.6 Received: from [193.136.128.21] ([193.136.128.21:45238] helo=smtp1.ist.utl.pt) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 64/CD-24501-5CA8E8C4 for ; Mon, 13 Sep 2010 16:34:14 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp1.ist.utl.pt (Postfix) with ESMTP id 74436700043F; Mon, 13 Sep 2010 21:34:10 +0100 (WEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at ist.utl.pt Received: from smtp1.ist.utl.pt ([127.0.0.1]) by localhost (smtp1.ist.utl.pt [127.0.0.1]) (amavisd-new, port 10025) with LMTP id 2u70m1E336DA; Mon, 13 Sep 2010 21:34:10 +0100 (WEST) Received: from mail2.ist.utl.pt (mail2.ist.utl.pt [IPv6:2001:690:2100:1::c]) by smtp1.ist.utl.pt (Postfix) with ESMTP id BF4E4700043E; Mon, 13 Sep 2010 21:34:09 +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 916F02003A36; Mon, 13 Sep 2010 21:34:09 +0100 (WEST) Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes To: "Stas Malyshev" Cc: "internals@lists.php.net" References: <4C873C0F.1010200@zend.com> <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> Date: Mon, 13 Sep 2010 21:34:22 +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: 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:02:34 +0100, Stas Malyshev wrote: > Hi! > >> The best (in the sense of "most similar to what we have today") syntax I >> can think of is to define annotations exactly the same way was you'd >> define arrays, but replace "array" with the annotation name (plus a >> prefix). I think this looks like PHP: > > We have here at least two non-PHP constructs - %Name meaning "new Name" > and array syntax for parameters. It's not an array syntax for parameters. Those would not be passed to a function, merely used to fill the fields of the annotation, like (object) array("a"=>1) creates a stdClass object with a field named "a" and value 1. The difference would be we wouldn't be creating dynamic fields, but only filling defined ones. >> could add a validate() method to ReflectionAnnotation (with an empty >> default implementation) that subclasses could override to provide their >> validation logic. > > When this validation logic will be called? On getAnnotation()? Then it > would be extremely wasteful - the annotation never changes but each time > is re-validated anew. > 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. >> Fair enough, though I find surprising that "parent" forwards. But you'll >> find that most users don't see LSB as a "scope that is forwarded" but >> instead as some kind of inheritance mechanism. It also exposed the odd > > I don't know how you found out what "most users" of PHP's multi-million > user base think - how many millions of people did you ask? - but whoever > has wrong preconceptions about how it works should correct them by > reading the actual docs. Provided that the actual rule can easily fit on > a bumper sticker, I don't think it's too complex. http://en.wikipedia.org/wiki/Sampling_(statistics) In any case, the manual page could be improved. It has a vague statement "static:: does not work like $this for static methods! $this-> follows the rules of inheritance while static:: doesn't. This difference is detailed later on this manual page" followed only by examples. -- Gustavo Lopes