Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49602 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 43004 invoked from network); 11 Sep 2010 20:02:43 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2010 20:02:43 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 87.230.78.165 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 87.230.78.165 www.mysqlusers.de Linux 2.5 (sometimes 2.4) (4) Received: from [87.230.78.165] ([87.230.78.165:43853] helo=beberlei.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 43/D4-17717-160EB8C4 for ; Sat, 11 Sep 2010 16:02:42 -0400 Received: from [192.168.1.34] (koln-4d0b1eab.pool.mediaWays.net [77.11.30.171]) by beberlei.de (Postfix) with ESMTPSA id B429E25A008E for ; Sat, 11 Sep 2010 22:02:38 +0200 (CEST) To: internals In-Reply-To: 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> Content-Type: text/plain; charset="UTF-8" Date: Sat, 11 Sep 2010 22:02:38 +0200 Message-ID: <1284235358.3323.13.camel@benny-pc> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: kontakt@beberlei.de (Benjamin Eberlei) Hey everyone, I want to re-drop my proposal onto the table that is just a shortcut notation for php class instantiation inside that brackets (omiting the new keyword): annotation := [className(classArgs*)] classArgs := array | string | int | float | ... Re-pasting my examples (this time from simple to complex): [ExpectedException("InvalidArgumentException")] [ExpectedException("InvalidArgumentException", "Expected message", 40")] [Validation(array("type" => "EMail", "options" => array("checkMX" => true))] [JoinTable(array( "name" => "users_phonenumbers", "joinColumns" => array( array("name" => "user_id", "referendedColumnName" => "id"), ), "inverseJoinColumns" => array( array("name => "phonenumber_id", "referendColumnName" => "id", "unique" => true), ), )] The only thing new here would be the brackets [] and the implicit class instantiation through omitting the new keyword. i.e. [Foo("bar")] would essentially mean new Foo("bar") when $refl->getAnnotation() is called. greetings, Benjamin On Sat, 2010-09-11 at 20:24 +0200, Pierre Joye wrote: > On Sat, Sep 11, 2010 at 8:19 PM, Stas Malyshev wrote: > > Hi! > > > >> The separator never was a problem... but I definately don't want to > >> see another 6 months just to define what would the separator be. > >> If we need to drop [] in favor of array support, I vote for ! as > >> separator. > > > > The separator is not a problem (even though 1-char one produces much less > > clutter). The cryptic syntax is. > > It seems that there is a misunderstanding about the goals of the > annotations. They are not meant to be read by human being > (javadoc/phpdoc/etc. are) but to be parsed automatically to be used > for services. > > In that sense, to have a syntax closed to one of the best (or less > worst, if you are on the opposed side ;-) syntax out there (c#/.net) > may be a good thing to do, instead of re einventing the php wheel. > > Cheers, > -- > Pierre > > @pierrejoye | http://blog.thepimp.net | http://www.libgd.org >