Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50270 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53313 invoked from network); 16 Nov 2010 21:56:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2010 21:56:57 -0000 X-Host-Fingerprint: 99.38.57.86 adsl-99-38-57-86.dsl.ipltin.sbcglobal.net Received: from [99.38.57.86] ([99.38.57.86:1651] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/AA-25421-72EF2EC4 for ; Tue, 16 Nov 2010 16:56:56 -0500 Message-ID: To: internals@lists.php.net Date: Tue, 16 Nov 2010 16:56:57 -0500 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.12) Gecko/20101027 Lightning/1.0b2 Thunderbird/3.1.6 MIME-Version: 1.0 References: <887FE7CFF6F8DE4BB3A9535F53AFD06A2C59B588@il-ex2.zend.net> <887FE7CFF6F8DE4BB3A9535F53AFD06A2C59B6A0@il-ex2.zend.net> <887FE7CFF6F8DE4BB3A9535F53AFD06A2C59D788@il-ex2.zend.net> In-Reply-To: <887FE7CFF6F8DE4BB3A9535F53AFD06A2C59D788@il-ex2.zend.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 99.38.57.86 Subject: Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) supportdiscussion From: alecgorge@gmail.com (Alec) But, in my opinion at least, parsing docblocks also brings in a new syntax. The only difference that I see is that parsing docblocks is wrapped in a comment and not syntax highlighted by most editors. Just out of curiosity, how did traits make it into 5.4 if we are avoiding syntax changes? You could use the same argument for traits: they introduce new syntax and advanced users can make do by copying and pasting. You could make the same argument for many features. You seem to have a issue with introducing new syntax. How would you feel if the syntax was very similar? Would you say that the "price" of this feature would be much lower and possibly even worth it. Maybe the syntax would look something like this: attribute RestMethod('/do/something', 'Do Stuff', 'Does something.', array( 'arg1' => 'A cool argument!' )); public static DoSomething($arg1) { ... or attribute Example('arg', 'arg2', 3, (time() > 0 ? true : false)); class Demo { ... That way it is clear that that line is an attribute. If the person doesn't know what an "attribute in PHP" is, they can Google it. This does the following: - No new branch of syntax is introduced like C# style annotations or parsed docblocks would. The syntax is very similar to standard PHP (the only thing missing is the "new" before the class name, and the only new thing is the word "attribute") - This doesn't add significant complexity. It essentially makes attributes autocalled class constructors. (As a side note, I don't think any part of PHP is significantly complex, it just isn't consistent--making it seem complex). - It is quite clear that that line is an attribute. People will be able to easily Google, find and read the PHP docs for an explanation. I know we aren't supposed to go into syntax, but I am curious as to people's reactions if things stay very "php-esque" instead of trying to create a new syntax/imitate another language. Also, don't get me wrong, I think parsable docblocks is a great idea and I support it--just not for annotations. -Alec On 11/16/2010 2:06 AM, Zeev Suraski wrote: >> -----Original Message----- >> From: Pierre Joye [mailto:pierre.php@gmail.com] >> Sent: Tuesday, November 16, 2010 1:45 AM >> To: Zeev Suraski >> Cc: guilhermeblanco@gmail.com; PHP internals >> Subject: Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support >> discussion >> >> On Tue, Nov 16, 2010 at 12:39 AM, Zeev Suraski wrote: >>> Suggesting phpdoc is used for the purposes mentioned does not mean we >> don't understand what we're talking about. >> >> I feel like you never used annotations in other languages, did you? > > You got me... But as an intelligent human being I'd like to think I can evaluate the merits of a feature without having to actually use it. > > I'm not saying that annotations don't give you any value. Sure they do. I'm saying that they come at a great price of adding an obscure branch of syntax into a language that's already grown significantly in complexity, and the bang for the buck isn't worth it. Those advanced developers needing that feature can make do with phpdoc. > > Zeev