Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49757 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41375 invoked from network); 17 Sep 2010 17:49:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Sep 2010 17:49:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 67.192.241.133 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 67.192.241.133 smtp133.dfw.emailsrvr.com Linux 2.6 Received: from [67.192.241.133] ([67.192.241.133:34443] helo=smtp133.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/81-30333-14AA39C4 for ; Fri, 17 Sep 2010 13:49:53 -0400 Received: from relay23.relay.dfw.mlsrvr.com (localhost [127.0.0.1]) by relay23.relay.dfw.mlsrvr.com (SMTP Server) with ESMTP id 962BA1568100; Fri, 17 Sep 2010 13:49:50 -0400 (EDT) Received: by relay23.relay.dfw.mlsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 373B21568545; Fri, 17 Sep 2010 13:49:49 -0400 (EDT) Message-ID: <4C93AA3D.8070507@sugarcrm.com> Date: Fri, 17 Sep 2010 10:49:49 -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: Pierre Joye CC: "RQuadling@googlemail.com" , PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] On how a little knowledge is completely useless. From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > Unless the PHP parser engine can be extended via normal or zend > extensions, no, it can't. And pretty useless to have annotations > outside the core... I disagree - it would be very useful *if* we could do that. I.e. if we could associate data with classes, functions, etc. without actually changing the code. Unfortunately, we don't have it yet. Some languages - like Python - have those as first-class objects, so you can just put stuff there. We don't have it, though we have Reflection - so we might use it instead. Then, the question of syntax arises. Basically, if we had method in ReflectionClass like this: static function addAnnotation($class, Annotation $a) { self::$annotations[$class][] = $a; } and we could have some useful syntax to call it implicitly - say, on class creation - that would be it. However, we have here two problems that we can't solve yet: 1) extending Reflection (maybe can be done in userspace) 2) adding syntax (probably can't be done in userspace unless somebody thinks of a clever way to do it). -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227