Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:50250 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6349 invoked from network); 16 Nov 2010 13:54:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Nov 2010 13:54:33 -0000 Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 209.85.214.170 mail-iw0-f170.google.com Received: from [209.85.214.170] ([209.85.214.170:51951] helo=mail-iw0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 9B/25-64124-E0D82EC4 for ; Tue, 16 Nov 2010 08:54:29 -0500 Received: by iwn41 with SMTP id 41so916674iwn.29 for ; Tue, 16 Nov 2010 05:54:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=0pIPooRIAxSTyFUUHcop9sNrmkgg+k8NDJEJuDoTG4s=; b=Ib+n9UhSwwgsse8Xyn7FsQqs0j3wxbfn78E9IWRLzkxqGNeXUwd3NOBRiQwpRL4/45 69W8X1I6A1NNliJjN+xX3OspPb5pZju7uLThlnmRCqR9yy2xvk74UTp9lWuhyN+v8ADB YrLcG/+rSlYH5yOmgijZG1HUL89x2V8jhJ93E= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Vko60bOmLewaLJRG/rY+2ekEdzbg+z+NidPagWciwnNl/18kKyjiI9YVigN3BNDgsy xUxhI3L0BwL4Dp13uXRXsBTdnDIT8k6cWAz+ebghmDkTEP+nUJesAKEW1jUNUTnmNwGp pxAAcnxful03NbsBHEIsKZ1tUuR3rcaHcPAEA= MIME-Version: 1.0 Received: by 10.231.33.5 with SMTP id f5mr5474651ibd.115.1289915654494; Tue, 16 Nov 2010 05:54:14 -0800 (PST) Received: by 10.231.179.134 with HTTP; Tue, 16 Nov 2010 05:54:14 -0800 (PST) In-Reply-To: References: Date: Tue, 16 Nov 2010 13:54:14 +0000 Message-ID: To: "guilhermeblanco@gmail.com" Cc: PHP internals Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PHP 5.4 - Meta attribute (aka. Annotations) support discussion From: petercowburn@gmail.com (Peter Cowburn) On 15 November 2010 17:07, guilhermeblanco@gmail.com wrote: > Hi folks, > > I'll start a series of topics (in this thread) about meta attribute > (aka. Annotations) discussion. > So as soon as we agree on each topic I'll open another point to be discus= sed. > Only when we reach some consensus I'll open another topic discussion. > I suggest to have a poll for each topic, so we can do some democratic > internals decision. I'd reduce the scope of voters to only people with > PHP karma. > > The first topic to be defined is: Does PHP need meta attribute support? > > Any language is built at the top of syntax, words, semantics and context. > We cannot define it as a language if we don't have these 4 parts well > fit together. > For a simple sentence like: I am all ears, we can easily identify these p= arts. > But the real meaning of this sentence (context) is only achieved with > another part of the language: signifier-significate. > A signifier is an atomic form, material element, visible, sensitive. > A significate is an idea, semantic content, conceptual element, not > sensitive perceptive. > > This important part is only reminded when we get back to semantics, > specifically when talking about idiomatic expressions, a metaphor in > our sample. The meaning will only work if we have the context, a known > information. Our sentence would mean that spoker person only have > ears, while the true meaning is that he/she is paying attention. > A computer language doesn't differ from a language by any means. We > have tokens (words), a syntax, semantic. But the lack of > contextualization brings a hole on language and how your application > should behave. This behavior can be achieved by many different ways; > the simplest way is known as meta information. > > Considering you have a lack of idiomatic expressions knowledge of > someone that is reading. He'd think person only have ears, but if you > meta notify him that it is a metaphor, he'd try to find a different > meaning. Example: (Metaphor) I am all ears. > > Now that we find how meta-information can benefit languages, it is > time to understand how meta-information can benefit a computer > language. > > A good example is define a Service that validates Domain Objects. > Imagining a scenario where you have a User class that holds email and > password. Email and password fields must be validated, for example, > email as an email and password with at least 6 chars. A generic > validation service could not have the User validation hardcoded inside > the service, so the solution would be an external factor that explains > to service how to validate the DO. One of the possible implementations > would be a UserValidator class that contains validation rules for each > field. This external factor is a good sample of meta-information. But > how would a meta attribute would solve this situation? > A Service could simple retrieve the validation instructions by > Reflecting the class which instance is going to be validated. > Basically, to validate a Domain Object, it is simply required to add > validation rules on desired attributes. Example: > > class User { > =A0 =A0 > =A0 =A0protected $email; > > =A0 =A0 > =A0 =A0protected $password; > } > > *NOTE*: Please understand that this do not enter in any implementation > details. It is not time (yet) to talk baout docblock, new syntax, etc. > Scope now is simpler than that. > > Now that is possible to see how meta attribute support could benefit a > language, I compiled a simple list of known projects and how can they > benefit of meta support: > - phpUnit Providing meta functionality for test cases, examples: > @dataProvider for test data iteration, @expectedException for catching > exceptions, etc. > - Doctrine For Object-Relational mapping, examples: @Entity, > @OneToOne, @Id, etc. > - Zend Framework Server classes Used to automate mappings for XML-RPC, > SOAP, etc. > - FLOW3 for dependency injection and validation > - Symfony2 for validation and routing rules > - Others: Validation, Functional Behavior injection (which could take > advantage of Traits), etc. > > > Poll will be opened for voting for 7 days (1 week) starting from now. > Poll will be closed next Monday at 5pm GMT. > Question: Does PHP need meta attribute support? > +1 on this poll. > Happy voting! > > -- > Guilherme Blanco > Mobile: +55 (16) 9215-8480 > MSN: guilhermeblanco@hotmail.com > S=E3o Paulo - SP/Brazil > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >