Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64616 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78195 invoked from network); 7 Jan 2013 00:12:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Jan 2013 00:12:48 -0000 Authentication-Results: pb1.pair.com smtp.mail=cpriest@zerocue.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cpriest@zerocue.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zerocue.com designates 67.200.53.250 as permitted sender) X-PHP-List-Original-Sender: cpriest@zerocue.com X-Host-Fingerprint: 67.200.53.250 mail.zerocue.com Received: from [67.200.53.250] ([67.200.53.250:33391] helo=mail.zerocue.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A2/00-12349-EF21AE05 for ; Sun, 06 Jan 2013 19:12:47 -0500 Received: from [172.17.0.145] (unknown [66.25.151.173]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.zerocue.com (Postfix) with ESMTPSA id 8B64F12037B; Mon, 7 Jan 2013 00:12:43 +0000 (UTC) References: <45FD2112-5469-48A2-8941-92415EC711E1@strojny.net> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-ID: <04DB7593-CF49-4F3C-9C28-287B768AC6A7@zerocue.com> Cc: PHP internals list X-Mailer: iPad Mail (10A523) Date: Sun, 6 Jan 2013 18:12:42 -0600 To: Sebastian Krebs Subject: Re: [PHP-DEV] [RFC] Reflection annotations reader From: cpriest@zerocue.com (Clint Priest) -Clint On Jan 6, 2013, at 5:11 PM, Sebastian Krebs wrote: > 2013/1/6 Yahav Gindi Bar >=20 >> On Mon, Jan 7, 2013 at 12:41 AM, Marco Pivetta wrote= : >>=20 >>>=20 >>> I think that our work is to isolate each annotation so it'll be easy to >>>> access, then, it'll be easy enough to write the code that creates >> "complex >>>> annotations", such as constructors and so on, in userland. >>>=20 >>> In fact, there's probably no need (now) to go on and build a full >>> annotation reader that instantiates classes and does fancy stuff as we >>> currently do in doctrine/common. >>> A fast parser is more than enough I suppose. That's our bottleneck >>> (besides scanning files). >>>=20 >>>=20 >>> Marco Pivetta >>>=20 >>> http://twitter.com/Ocramius >>>=20 >>> http://ocramius.github.com/ >>=20 >> So the problem is the syntax which is difference? >> When wrote this RFC, I just though about basic cases... >>=20 >> Though I agree with you that the main problem is the syntax. >> We can extract the entire doc-comment and only isolate between annotation= s, >> so doc-comment like: >> /** >> * @Route("/") >> * @ORM(Key=3D"foo") >> * @var string >> */ >>=20 >> Will be : array( 'Route("/")' =3D> "", 'ORM(Key=3D"foo")' =3D> "", "var" =3D= > >> "string" ) >> But the question is it really worth it, since you'll probably need to >> create some sort of "sub-parser" that uses this isolated annotations arra= y >> and apply on them your syntax. >=20 > As a suggestion, that should cover most (all?) cases: The identifier could= > be defined as "between @ and the first non-alphanumeric character" (it > should probably allow some special like "/", or "\" to allow namespace-lik= e > annotations). @Route("/") would be array( 'Route' =3D> '("/")'. Now a > secondary parser only needs to take care about ("/"), but for example it > can already directly test, whether or not the annotation exists. >=20 >=20 >>=20 >> That's being said, if we'll see performance improvements, I really think >> that it's a good solution to start with, since because its not an >> Attributes, I don't think that we should dictate the syntax for each >> application. Each application will get the doc-comment annotation and wil= l >> be able to apply on it its own syntax and fancy stuff... I think that it'= s >> the best solution because of BC too. >=20 > To throw that in: Multiline-annotations must be taken into account too :) >=20 >=20 > Regards, > Sebastian >=20 >=20 >>=20 >> What do you think? >=20 >=20 >=20 > --=20 > github.com/KingCrunch