Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49598 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 68453 invoked from network); 11 Sep 2010 11:01:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Sep 2010 11:01:01 -0000 Authentication-Results: pb1.pair.com smtp.mail=christian.kaps@mohiva.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=christian.kaps@mohiva.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain mohiva.com designates 78.46.69.5 as permitted sender) X-PHP-List-Original-Sender: christian.kaps@mohiva.com X-Host-Fingerprint: 78.46.69.5 zucker.schokokeks.org Received: from [78.46.69.5] ([78.46.69.5:38025] helo=zucker.schokokeks.org) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4D/08-17717-B616B8C4 for ; Sat, 11 Sep 2010 07:01:00 -0400 Received: from [192.168.178.2] (p57B567C3.dip.t-dialin.net [::ffff:87.181.103.195]) (AUTH: PLAIN christian.kaps@mohiva.com, SSL: TLSv1/SSLv3,256bits,CAMELLIA256-SHA) by zucker.schokokeks.org with esmtp; Sat, 11 Sep 2010 13:00:56 +0200 id 0000000000018002.000000004C8B6168.00001EEF Message-ID: <4C8B6168.30504@mohiva.com> Date: Sat, 11 Sep 2010 13:00:56 +0200 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.8) Gecko/20100903 Lightning/1.0b2pre Thunderbird/3.1.2 MIME-Version: 1.0 To: Pierrick Charron , internals@lists.php.net References: <4C873C0F.1010200@zend.com> <4C879613.7090709@zend.com> <4C887D2B.2000605@zend.com> <4C8AC526.7000505@sugarcrm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: christian.kaps@mohiva.com (Christian Kaps) Hi, >> %Annotation(%Email(checkMX = true)); at first I thought what for an ugly syntax. But after a time I think it is regardless of whether the % or @(from Java, which I prefer over all, if it were possible) syntax is used. It looks very similar. So I prefer the % syntax so we can use the [] for defining arrays in annotations. Is it possible to define objects from type stdClass in the form %Annotation({key: 'value'})? An other question. Is it necessary to terminate an annotation with a semicolon, like in your example? class Compiler { /** * Compile a node into plain PHP. * * @param Node $node The node to compile. */ %Annotation(%Email(checkMX = true)) %ResourceParameter(['key' => 'name', 'value' => 'annotation']) %Inject('\my\name\space\Class') %Test %Annotation({key: 'value'}) public function compile(Node $node) { } } Greetings, Christian Am 11.09.2010 02:23, schrieb Pierrick Charron: > Hi Stas, > > Annotations is a new concept in PHP (even if some framework already > use an user space implementation of them) and I think it is normal > that people will have to read a little bit about this eventually new > feature before using it. This is the same thing for traits, if you > don't know what is a trait you will not know how to use them. But once > you know the concept it's really easy to understand what is an > annotation class, parameter etc... > > Is it really the [] Syntax that you don't like for annotations ? I was > personally not against the [] array syntax and I understand that this > annotation syntax will make the future implementation of this [] array > syntax impossible. So I could change it to the syntax proposed by > Etienne in the first thread : > > %Annotation(%Email(checkMX = true)); > > I'm not against any other proposal of syntax so if you have one to > proposition do not hesitate. > > Regards, > Pierrick > > > > 2010/9/10 Stas Malyshev : >> Hi! >> >>> [Validation(Email(checkMX=>true))] looks better. >> Even here it's not clear what is happening. What is "Validation", what is >> "Email", what is "checkMX" (are they all classes? or only some of them?), >> what is happening to them (are these classes being instantiated? when? what >> is passed as parameters? What is the scope of that? etc). Why can we have >> now two ways to instantiate classes, complete with mix of []s and ()s, but >> having array syntax using [] is still too complex? >> >> -- >> Stanislav Malyshev, Software Architect >> SugarCRM: http://www.sugarcrm.com/ >> (408)454-6900 ext. 227 >> >> -- >> PHP Internals - PHP Runtime Development Mailing List >> To unsubscribe, visit: http://www.php.net/unsub.php >> >>