Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52201 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 4298 invoked from network); 10 May 2011 08:02:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2011 08:02:48 -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:55687] helo=mail1.screenlight.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 72/70-01064-421F8CD4 for ; Tue, 10 May 2011 04:02:45 -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)) for internals@lists.php.net; Tue, 10 May 2011 10:02:41 +0200 Message-ID: <4DC8F125.2010503@toolpark.com> Date: Tue, 10 May 2011 10:02:45 +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: internals@lists.php.net References: <4DC826B1.4090806@lerdorf.com> <4DC82A36.8090604@lerdorf.com> <4DC83401.2090202@sugarcrm.com> <4DC8D122.3050507@lsces.co.uk> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] annotations again From: lars.schultz@toolpark.com (Lars Schultz) Am 10.05.2011 09:44, schrieb Ferenc Kovacs: > On Tue, May 10, 2011 at 9:01 AM, Chad Fulton wrote: > >> On Mon, May 9, 2011 at 10:46 PM, Lester Caine wrote: >>> *IS* it clear by now that the majority of users want this? >> >> For what it's worth, I still oppose Annotations. >> >>> And the argument >>> that 'You don't have to use it' does not wash either since once it has >> been >>> pushed in, some of the libraries we are using are going to start >> requiring >>> it simply because those developers do like the idea, but it does not >>> necessarily mean that THE CURRENT PROPOSAL is the right way of doing it? >> >> I especially oppose the complexity of the current proposal. One of the >> reasons I prefer PHPDoc to the proposed Annotations is because they're >> a simple key=>value syntax. >> > > that would be the same argument that we don't need objects because we have > arrays, and if you only need something to store your structures, then both > can be used for that. > > >> >> I'm already doing my coding in PHP - why do I have to code in a new >> sub-language when all I want is a litte bit of meta-data? >> > > nobody is forcing you to use annotations, it won't replace the docblocks. > > >> >> My main question is: Why do we need more than key=>value? When you say >> that "everyone" supports annotations (if that is true), are you sure >> they actually want more than key=>value? >> > > at least Doctrine, Symfony and FLOW3 does. > Sebastian expressed that he is fine with the current Docblock support for > PHPUnit. > the FLOW3 used to use single key values in the past, but I'm not familiar > with the current situation. > > for actual use-cases you can check > http://blog.seric.at/2011/05/03/annotations-with-symfony2/ > or > http://www.doctrine-project.org/docs/orm/2.0/en/reference/annotations-reference.html#annref-column > > > >> >> Discussion of this does not seem to appear in your "Why do we need >> Class Metadata?" section. >> > > I also think that it would be a good idea to link or describe annotations in > general, because it seems that nobody bothers to read that up without > joining the conversation... > > Tyrael > From the user-end perspective, what I don't understand is this: What is the goal of having Annotations embedded in PHP? To nail down a common syntax? To provide an interface for meta-information on a class? Why can't this be PHP code? Why should I have to learn a whole new kind of syntax? We already have a common syntax (PHP interface) for this as well as an interface (static Class-functions/Object-methods). To explain what I mean, I'll use the example provided in the RFC. Could anyone please explain the advantages of having "passive" annotations over "active" PHP Code. class User { protected $id; // ... protected $Phonenumbers; } *** Example *** class User implements EntityAnnotation { protected $id; protected $Phonenumbers; public function getEntityAnnotation(){ return new User_EntityAnnotation(); } } class User_EntityAnnotation { public function getEntityName(){ return 'users'; } public function getColumnInfo($property){ switch( $property ) { case 'id': return array( 'column'=>'integer', 'isPrimary'=>true, 'autoIncrement'=>true ); case 'Phonenumbers': return array( 'manytomany'=>'Phonenumber' ); } } } ***************