Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64615 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74170 invoked from network); 6 Jan 2013 23:11:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jan 2013 23:11:37 -0000 Authentication-Results: pb1.pair.com header.from=sebastian.krebs.berlin@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=krebs.seb@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.42 as permitted sender) X-PHP-List-Original-Sender: krebs.seb@gmail.com X-Host-Fingerprint: 74.125.82.42 mail-wg0-f42.google.com Received: from [74.125.82.42] ([74.125.82.42:41818] helo=mail-wg0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/6A-04877-7A40AE05 for ; Sun, 06 Jan 2013 18:11:36 -0500 Received: by mail-wg0-f42.google.com with SMTP id dr1so1717969wgb.3 for ; Sun, 06 Jan 2013 15:11:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:x-google-sender-delegation:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to :content-type; bh=BXzXg5ps6PUMwv/ZT6EySGTnCANORI4qSj6A41e4ChU=; b=GG4hwmI6k0xX9KtFA4RdGdE5X2yMFwNILXu0Hr+/7vV9AE2aK9ULIN9C5cu3yTBA+V 3aFcGG2gkjpCcyFBxspS3mufamUX6CezNUg8SHEdCM1dR/wj8VwSHfSXEoV5//fNkIjH jZa3560IBS50tQZ2J0Oot17bSzKwmv1Aw33XcVzf7Nu7kfIAodD7691tdjKNk5jZleCA yGTKpPxWz6Dn5XlS01C+Q6RrdqUfHV8Cs8/4R8UUs2AIX16kEPp1Anpf5oCOhp+FMxXG cZ7fTsT7d4BEeN2uCwDGRo7QjX8wWwZ0aFHM6aZ3QdhS9VJ0sfhNrOcBA8R7gKXwVb4d h84w== MIME-Version: 1.0 Received: by 10.194.179.34 with SMTP id dd2mr93003308wjc.1.1357513892384; Sun, 06 Jan 2013 15:11:32 -0800 (PST) Sender: sebastian.krebs.berlin@gmail.com X-Google-Sender-Delegation: sebastian.krebs.berlin@gmail.com Received: by 10.216.119.70 with HTTP; Sun, 6 Jan 2013 15:11:32 -0800 (PST) In-Reply-To: References: <45FD2112-5469-48A2-8941-92415EC711E1@strojny.net> Date: Mon, 7 Jan 2013 00:11:32 +0100 X-Google-Sender-Auth: ciXXjbSxJl5JjC785ztJH-NfuJE Message-ID: To: PHP internals list Content-Type: multipart/alternative; boundary=089e0141a002554e8604d2a6d577 Subject: Re: [PHP-DEV] [RFC] Reflection annotations reader From: krebs.seb@gmail.com (Sebastian Krebs) --089e0141a002554e8604d2a6d577 Content-Type: text/plain; charset=ISO-8859-1 2013/1/6 Yahav Gindi Bar > On Mon, Jan 7, 2013 at 12:41 AM, Marco Pivetta wrote: > > > > > 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. > >> > > > > 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). > > > > > > Marco Pivetta > > > > http://twitter.com/Ocramius > > > > http://ocramius.github.com/ > > > > So the problem is the syntax which is difference? > When wrote this RFC, I just though about basic cases... > > Though I agree with you that the main problem is the syntax. > We can extract the entire doc-comment and only isolate between annotations, > so doc-comment like: > /** > * @Route("/") > * @ORM(Key="foo") > * @var string > */ > > Will be : array( 'Route("/")' => "", 'ORM(Key="foo")' => "", "var" => > "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 array > and apply on them your syntax. > 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-like annotations). @Route("/") would be array( 'Route' => '("/")'. Now a secondary parser only needs to take care about ("/"), but for example it can already directly test, whether or not the annotation exists. > > 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 will > be able to apply on it its own syntax and fancy stuff... I think that it's > the best solution because of BC too. > To throw that in: Multiline-annotations must be taken into account too :) Regards, Sebastian > > What do you think? > -- github.com/KingCrunch --089e0141a002554e8604d2a6d577--