On 16 November 2010 07:06, Zeev Suraski <z...@zend.com> wrote: >> -----Original Message----- >> From: Pierre Joye [mailto:pierre....@gmail.com] >> Sent: Tuesday, November 16, 2010 1:45 AM >> To: Zeev Suraski >> Cc: guilhermebla...@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 <z...@zend.com> 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
Hi all. I use PHPDoc. I develop SOAP services and use ZF to autocreate my WSDL files. I've used tools to create classes from a WSDL file. I don't know how this qualifies specifically as "annotations" - so I'm probably in the same camp as Zeev on this. An issue for me is the lack of ongoing development (it seems) of phpdoc. Yes, sure, it is for documentation. But that is just one sort of annotation. [1] I think having a mechanism which is easily understood in both human and machine terms and obeys a simple, expandable syntax, then this would seem to be extremely useful. I like the idea of JSON encoded annotations. JSON is very simple to understand (if you can manually create a nested associative array in PHP, you can create JSON encoded data). I think for more complex annotations, a simple @tag doesn't seem like it is going to be enough. There is no way to nest the tags in any meaningful and validatable way. At least not in a way that is obvious when you read it. Also, for every new @tag, you have to tell PHPDoc to ignore it as it will produces noise. But consider now the amount of PHPDoc blocks out there. A PHPDoc -> annotations converter would have to be developed. Theoretically, one _SHOULD_ be able to do that using a PHPDoc template - I think - not an area I know well. One issue mentioned is that having annotations will have a "performance hit" on PHP. I'm obviously missing something here. If the annotation is in a blockcomment, then that would seem to satisfy the performance issue. Reading the annotation for normal runtime execution would seem wrong. Only as part of reflection or annotation specific access should the block be "decoded" into whatever form is required. So, aren't annotations really just an extension to the docblock decoding aspects of reflection? Do we have a "performance hit" because of reflection? I know I know very little about the impact on PHP, but a simple syntax wrapped in a comment would really seem to be an ideal approach to me. So much so, I'm almost surprised we need anything in the core at all. Regards, Richard. [1] http://en.wikipedia.org/wiki/Annotation#Software_programming -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php