Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52202 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6316 invoked from network); 10 May 2011 08:10:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 May 2011 08:10:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=j.boggiano@seld.be; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=j.boggiano@seld.be; sender-id=pass Received-SPF: pass (pb1.pair.com: domain seld.be designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: j.boggiano@seld.be X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:41730] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 94/D0-01064-DF2F8CD4 for ; Tue, 10 May 2011 04:10:38 -0400 Received: by bwz18 with SMTP id 18so5393687bwz.29 for ; Tue, 10 May 2011 01:10:34 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.141.14 with SMTP id k14mr661805bku.37.1305015033756; Tue, 10 May 2011 01:10:33 -0700 (PDT) Received: by 10.204.153.205 with HTTP; Tue, 10 May 2011 01:10:33 -0700 (PDT) In-Reply-To: <4DC8F125.2010503@toolpark.com> References: <4DC826B1.4090806@lerdorf.com> <4DC82A36.8090604@lerdorf.com> <4DC83401.2090202@sugarcrm.com> <4DC8D122.3050507@lsces.co.uk> <4DC8F125.2010503@toolpark.com> Date: Tue, 10 May 2011 10:10:33 +0200 Message-ID: To: Lars Schultz Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] annotations again From: j.boggiano@seld.be (Jordi Boggiano) On Tue, May 10, 2011 at 10:02 AM, Lars Schultz wrote: > What is the goal of having Annotations embedded in PHP? To nail down a > common syntax? To provide an interface for meta-information on a class? I think the main reasons are standardization of the syntax and performance of the parsing. At the moment everyone has to cache the stuff because hitting the tokenizer every time is quite expensive. Honestly if there was a way to parse them into the docblocks, I think it would be better because it would allow us to keep BC with older PHP versions, but since docblocks contain documentation as well, I think you can't really parse it all without creating a mess. > Why can't this be PHP code? Why should I have to learn a whole new kind of > syntax? We already have a common syntax (PHP interface) for this as well as > an interface (static Class-functions/Object-methods). Annotations are not code, but more like metadata to tell the surrounding libraries how to work best with a piece of code. > To explain what I mean, I'll use the example provided in the RFC. Could > anyone please explain the advantages of having "passive" annotations over > "active" PHP Code. I think your example shows very well why annotations are good, it's much more concise. Cheers -- Jordi Boggiano @seldaek :: http://seld.be/