Hi!
Unless the PHP parser engine can be extended via normal or zend
extensions, no, it can't. And pretty useless to have annotations
outside the core...
I disagree - it would be very useful *if* we could do that. I.e. if we
could associate data with classes, functions, etc. without actually
changing the code. Unfortunately, we don't have it yet. Some languages -
like Python - have those as first-class objects, so you can just put
stuff there. We don't have it, though we have Reflection - so we might
use it instead.
Then, the question of syntax arises. Basically, if we had method in
ReflectionClass like this:
static function addAnnotation($class, Annotation $a) {
self::$annotations[$class][] = $a;
}
and we could have some useful syntax to call it implicitly - say, on
class creation - that would be it. However, we have here two problems
that we can't solve yet: 1) extending Reflection (maybe can be done in
userspace) 2) adding syntax (probably can't be done in userspace unless
somebody thinks of a clever way to do it).
--
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