On Tue, May 10, 2011 at 10:02 AM, Lars Schultz
<lars.schu...@toolpark.com> wrote:
> What is the goal of having Annotations embedded in PHP? To nail down a
> common syntax? To provide an interface for meta-information on a class?

I think the main reasons are standardization of the syntax and
performance of the parsing. At the moment everyone has to cache the
stuff because hitting the tokenizer every time is quite expensive.

Honestly if there was a way to parse them into the docblocks, I think
it would be better because it would allow us to keep BC with older PHP
versions, but since docblocks contain documentation as well, I think
you can't really parse it all without creating a mess.

> Why can't this be PHP code? Why should I have to learn a whole new kind of
> syntax? We already have a common syntax (PHP interface) for this as well as
> an interface (static Class-functions/Object-methods).

Annotations are not code, but more like metadata to tell the
surrounding libraries how to work best with a piece of code.

> To explain what I mean, I'll use the example provided in the RFC. Could
> anyone please explain the advantages of having "passive" annotations over
> "active" PHP Code.

I think your example shows very well why annotations are good, it's
much more concise.

Cheers

-- 
Jordi Boggiano
@seldaek :: http://seld.be/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to