Hi Larz, On Wed, May 11, 2011 at 4:02 AM, Lars Schultz <lars.schu...@toolpark.com> wrote: > 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? >
The patch does all compile time and runtime validations, so your assertion is not valid. >> 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. > If you tell me that you're doing this: class User implements PersistenceEntity { // ... } You're coupling your Entity to an individual persistence tool. This means you have a huge problem, because you're coupling things that should be separated. This breaks the clean separation of concerns that OO brings to us. > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Guilherme Blanco Mobile: +55 (16) 9215-8480 MSN: guilhermebla...@hotmail.com São Paulo - SP/Brazil -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php