Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49607 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10569 invoked from network); 12 Sep 2010 18:55:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2010 18:55:21 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.143 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.143 smtp143.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.143] ([67.192.241.143:38771] helo=smtp143.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 23/3E-17717-8122D8C4 for ; Sun, 12 Sep 2010 14:55:20 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp4.relay.dfw1a.emailsrvr.com (SMTP Server) with ESMTP id 1A911E8174; Sun, 12 Sep 2010 14:55:18 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp4.relay.dfw1a.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 623E7E81BC; Sun, 12 Sep 2010 14:55:17 -0400 (EDT) Message-ID: <4C8D2214.2030904@sugarcrm.com> Date: Sun, 12 Sep 2010 11:55:16 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.9) Gecko/20100825 Thunderbird/3.1.3 MIME-Version: 1.0 To: Christian Kaps CC: Pierre Joye , Guilherme Blanco , Pierrick Charron , "internals@lists.php.net" References: <4C873C0F.1010200@zend.com> <4C879613.7090709@zend.com> <4C887D2B.2000605@zend.com> <4C8AC526.7000505@sugarcrm.com> <4C8B6168.30504@mohiva.com> <4C8BC81E.8000605@sugarcrm.com> <4C8C073F.402@sugarcrm.com> <4C8C8FBC.3090007@mohiva.com> In-Reply-To: <4C8C8FBC.3090007@mohiva.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > 1. In Java annotations are a special type of an interface. But due the > lack of type hinting for scalar values we cannot use this construct, > because we cannot put some validation logic in an interface. My proposal I'm not sure I understand - what scalar type hints have to do with it? Anyway, annotation can't be interface since you'd have to instantiate it to get the values. Interface can't have values. > is to create a new "annotation" type. This type should have the same > rules as a class and should contain all features proposed in the > ReflectionAnnotation class. With this construct it should be possible to > use named or unnamed parameters for an annotation. I think this is very bad idea - to have language construct that is exactly like class but has different set of features. If named parameters are needed in PHP, let's add named parameters in PHP. But if we decide they are not needed in PHP, they shouldn't be in one particular corner of a particular syntax construct and nowhere else. This makes the language hard to learn and hard to understand - you never know what surprise the next syntax construct will bring you. I'm very strongly against only one construct in the language having named parameters syntax while other places don't. > 2. The syntax for arrays should be the same as in PHP. So we can use the > [] as annotation separator. When we allow expressions in the form > Annotation(array('value' => 4 %2)) or Annotation(array('value' => > !MY_CONSTANT)) which I think is a valid construct, then we cannot use > the ! or % as annotation separator. Where this expression would be evaluated, in which context? Where would the variable values be stored? What happens if they change? > I think with this changes we have a separate language construct like > traits, which does allow a new syntax. Separate language construct doesn't mean separate rules. We are still in the same language, so we can't just randomly put arbitrary set of features together and call it a new construct. There should be some commonality between different language constructs within the same language. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227