Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52272 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41102 invoked from network); 11 May 2011 07:03:11 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2011 07:03:11 -0000 Authentication-Results: pb1.pair.com smtp.mail=lars.schultz@toolpark.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lars.schultz@toolpark.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain toolpark.com from 195.49.42.12 cause and error) X-PHP-List-Original-Sender: lars.schultz@toolpark.com X-Host-Fingerprint: 195.49.42.12 mail1.screenlight.ch Received: from [195.49.42.12] ([195.49.42.12:58040] helo=mail1.screenlight.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/70-37490-DA43ACD4 for ; Wed, 11 May 2011 03:03:10 -0400 Received: from [192.168.1.112] ([192.168.1.112]) (authenticated user lars.schultz@toolpark.com) by mail1.screenlight.ch (Kerio Connect 7.0.2 patch 1) (using TLSv1/SSLv3 with cipher AES256-SHA (256 bits)); Wed, 11 May 2011 09:02:42 +0200 Message-ID: <4DCA3492.7000209@toolpark.com> Date: Wed, 11 May 2011 09:02:42 +0200 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.9) Gecko/20100915 Lightning/1.0b2 Thunderbird/3.1.4 MIME-Version: 1.0 To: PHP internals CC: Martin Scotta References: <4DC826B1.4090806@lerdorf.com> <4DC82A36.8090604@lerdorf.com> <4DC83401.2090202@sugarcrm.com> <4DC8D122.3050507@lsces.co.uk> <4DC8F125.2010503@toolpark.com> <4DC94753.9040800@toolpark.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] annotations again From: lars.schultz@toolpark.com (Lars Schultz) 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 > class Class { } interface Annotation { function getParam(); } > and how do you apply an interface to a method? > 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.