Am 10.05.2011 16:53, schrieb Martin Scotta:
Annotations are not required, you add them if you want to.
Yes. sure. But I am sure that certain Annotations must be combined to unleash their purpose, no? There is no validation for that, correct?

Also they can be used not only with classes. You can annotate methods,
members, parameters (I'm not sure about the RFC scope)
With the interface approach you can annotate classes, methods, members and parameters, depending on how you build it, no? Annotating functions by themselves...is that really an issue? Since they're mostly stateless why would they need meta-data?

with "extends" you inherit implementation
with "traits" you inherit code
With annotations you inherit behavior.
inheriting behaviour is just a special case of inheriting "code" as in traits, no?

you cannot do this with interfaces
<Annotation(param=Value)> class Class { }

interface Annotation { function getParam(); }

and how do you apply an interface to a method?
<Deprecated> function getSomething() { }

interface Annotation {
        function getMethodAnnotation($method){
                switch( $method ) {
                        case 'getSomething': return array('deprecated');
                }
        }
}

All the framework/library boiler-plate should be reduced to minimum.
I can't argue with that.

What I just noticed is that simple examples (key=>value or even just keywords) are indeed concise and I could imagine using it this way. But for that we have docblocs. But as soon as you go into more complex structures, more than key=>value which guilherme keeps arguing is so essential to the Annotations and is also why we can't use docblocks, it gets unreadable and especially for maintaining state within meta-data, I'd always use PHP-Interfaces over Annotations.


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

Reply via email to