Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51674 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 13055 invoked from network); 13 Mar 2011 21:34:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Mar 2011 21:34:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=colder@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=colder@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 94.103.100.39 as permitted sender) X-PHP-List-Original-Sender: colder@php.net X-Host-Fingerprint: 94.103.100.39 mailer.immomigsa.ch Linux 2.6 Received: from [94.103.100.39] ([94.103.100.39:58556] helo=mailer.immomigsa.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 50/30-11364-2783D7D4 for ; Sun, 13 Mar 2011 16:34:44 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by mailer.immomigsa.ch (Postfix) with ESMTP id 3888D4B60DFF; Sun, 13 Mar 2011 22:34:40 +0100 (CET) X-Virus-Scanned: amavisd-new at immomigsa.ch Received: from mailer.immomigsa.ch ([127.0.0.1]) by localhost (mailer.immomigsa.ch [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ox8pYYtR-9-O; Sun, 13 Mar 2011 22:34:39 +0100 (CET) Received: from crousti (46-126-188-75.dynamic.hispeed.ch [46.126.188.75]) by mailer.immomigsa.ch (Postfix) with ESMTPSA id 1079E4B60DFA; Sun, 13 Mar 2011 22:34:37 +0100 (CET) Received: by crousti (sSMTP sendmail emulation); Sun, 13 Mar 2011 22:33:56 +0100 Date: Sun, 13 Mar 2011 22:33:56 +0100 To: Marcelo Gornstein Cc: internals@lists.php.net Message-ID: <20110313213356.GC4446@crousti> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) Subject: Re: [PHP-DEV] native php annotations From: colder@php.net (Etienne Kneuss) On Mar 13 17:50:33, Marcelo Gornstein wrote: > Hello All, > > I'm new to this list, so please excuse me if this subject was already > discussed, or proposed. Hi, it has already been discussed with length. Please take a look at: http://wiki.php.net/rfc/annotations it would be more productive if you explain in what ways your proposal differs from the one above, and why that should be so. Best, > > I've made an experimental patch to ZendEngine/PHP (5.3.5) to allow > native annotations (without doc comments), using the token @@ (the @ > was already taken). It allows 0 or more annotations (with 0 or more > arguments each one) for classes, properties, methods, and arguments > for methods, like: > > @@Annotation(key="value1") > class A { > @@Annotation(key="value1") > private $property; > > @@Annotation(key="value1") > private function aMethod(@@Annotation(key="value1") @@Annotation2 $a, $b) { > ... > } > } > > The patch can be found at: https://github.com/marcelog/AnoForPHP. > > The annotations and their optional arguments can be retrieved via the > getAnnotations() method of ReflectionClass, ReflectionMethod, > ReflectionParameter, and ReflectionProperty. > > I plan to extend this patch with some extended functionality, like > having PHP instantiate a given class for the given annotation. By > using convention instead of configuration, the name of the annotation > is the name of the class, which should also extend some PHP base > class, like "Annotation". > > I'm basically looking for comments on the patch and the functionality, > since I'm new to the ZendEngine as well. > > Again, I'm sorry if this post should not go here or there is not > interest in such a feature in the language itself. Also, if I missed > something in the code of the patch, because it's more like a > proof-of-concept than a final formal proposal. > > Regards! > > > -- > // I don't sleep. I coffee. > "Make everything as simple as possible, but not simpler." -- Albert Einstein > "The class object inherits from Chuck Norris." > "Chuck Norris can divide by zero and can unit test an entire > application with a single assert." > "There’s a lot of work happening behind the scenes, courtesy of the > Spring AOP framework" > "Why do I have this nagging hunch that you have no idea what you're doing?" > "Any society that would give up a little liberty to gain a little > security will deserve neither and lose both" - Benjamin Franklin > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >