Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52302 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30123 invoked from network); 11 May 2011 15:58:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2011 15:58:57 -0000 Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:50762] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/9D-45512-042BACD4 for ; Wed, 11 May 2011 11:58:57 -0400 Received: by gxk27 with SMTP id 27so254615gxk.29 for ; Wed, 11 May 2011 08:58:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=/l21cXk5juz3mytoUejCOfEoE91ca5YBJyW8wTPIPuc=; b=XBDMDsRzXoIJiRlBOCk7aaAWtUBK26VnGgZYUGhVhiTT15LQ3Eh7QR5SluM6tWMjpn K+krRDBwuymT+9RTFJ0Q6BoObbo7ArBRdWFLvGVK14/WhtzElQzXG4PzY3MYtXa1VMRd 5soG3Pil/zRpVDvtGpB+IA9JQtAM4Bz1pic9g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=jBy4smrMjP04cJCv5qqy7GNk9FDkiAcF6/TrmLthC5pzWIdCV02q4/evBRe8tLku6h 4OxWY78um3L/0sSuNQh40YDSXrZLnCzZOkuzPs901+w52Mupt4D8Xb4TU4Is3jFA9WWl vspqtZ8To0039JTIv7Lr1dWTnMWEuckEUjAFU= Received: by 10.236.185.163 with SMTP id u23mr11058086yhm.177.1305129534115; Wed, 11 May 2011 08:58:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.147.171.4 with HTTP; Wed, 11 May 2011 08:58:33 -0700 (PDT) In-Reply-To: <4DCA3492.7000209@toolpark.com> 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> <4DCA3492.7000209@toolpark.com> Date: Wed, 11 May 2011 12:58:33 -0300 Message-ID: To: Lars Schultz Cc: PHP internals , Martin Scotta Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] annotations again From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") Hi Larz, On Wed, May 11, 2011 at 4:02 AM, Lars Schultz w= rote: > 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 an= d > 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 { > =C2=A0 =C2=A0 =C2=A0 =C2=A0function getMethodAnnotation($method){ > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0switch( $method ) = { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0case 'getSomething': return array('deprecated'); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0} > =C2=A0 =C2=A0 =C2=A0 =C2=A0} > } > >> 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=3D>value or even just > keywords) are indeed concise and I could imagine using it this way. But f= or > that we have docblocs. But as soon as you go into more complex structures= , > more than key=3D>value which guilherme keeps arguing is so essential to t= he > Annotations and is also why we can't use docblocks, it gets unreadable an= d > 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 > > --=20 Guilherme Blanco Mobile: +55 (16) 9215-8480 MSN: guilhermeblanco@hotmail.com S=C3=A3o Paulo - SP/Brazil