Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:49637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44893 invoked from network); 13 Sep 2010 18:33:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Sep 2010 18:33:28 -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:37334] helo=smtp133.dfw.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/9A-24501-77E6E8C4 for ; Mon, 13 Sep 2010 14:33:28 -0400 Received: from relay23.relay.dfw.mlsrvr.com (localhost [127.0.0.1]) by relay23.relay.dfw.mlsrvr.com (SMTP Server) with ESMTP id 6789015683D7; Mon, 13 Sep 2010 14:33:25 -0400 (EDT) Received: by relay23.relay.dfw.mlsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id E808F1568120; Mon, 13 Sep 2010 14:33:24 -0400 (EDT) Message-ID: <4C8E6E74.3060207@sugarcrm.com> Date: Mon, 13 Sep 2010 11:33:24 -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: Benjamin Eberlei CC: "internals@lists.php.net" References: <4C873C0F.1010200@zend.com> <4C879613.7090709@zend.com> <4C887D2B.2000605@zend.com> <4C8AC526.7000505@sugarcrm.com> <4C8B6168.30504@mohiva.com> <4C8BC81E.8000605@sugarcrm.com> <7.0.1.0.2.20100913145703.0d226d90@zend.com> <0f5a11f744bbcf99d8217f40da3a302a@beberlei.de> In-Reply-To: <0f5a11f744bbcf99d8217f40da3a302a@beberlei.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Re: PHP Annotations RFC + Patch From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > PHPDocs are for what their name suggests, for comments, not for runtime > code information. They allow arbitrary characters, their intent is for > human-readible documentation only. Nothing prevents us from using phpdocs for non-human-reading purposes. Actually, there is quite a lot of code that already does it successfully. I don't see anything heretical in having phpdoc tag parser in reflection and using it for metadata purposes - after all, phpdoc currently IS being used as metadata and actually it was its intent from the start. > Primary difference of Annotations, they are not only human- but also > enforced to be machine-readable. Annotations are runtime configuration or phpdoc tags are enforced to be machine readable as well. > metadata, throwing compile time parse errors when not followed correctly. There's no such thing as compile time in PHP. Practically everything in PHP is runtime. And as I see, people want validation logic in their annotations - which makes it even more runtime. > That has nothing to do with documentation, it is an very elegant way to > extend classes, methods and properties with metadata information, > configuration and code right next to each other. What prevents you from using plain old way of adding information to classes? I understand that new syntax is much cooler than boring old one - but besides that? > 1. Developers should expect to be able to delete a comment/docblock > without altering the code-path. It's circular argument. If phpdoc is used for metadata, they can't. > 2. Errors in the Doc-Blocks "expected formatting" are left for the > userland developer to detect. IDEs or the PHP Parser simply don't care. How it's a bad thing? IDEs can do whatever they want, and PHP parser shouldn't be broken by metadata. > 3. There is no real difference for a human only readable doclbock starting > with /** or /*, however PHP just doesnt publish the /* docblocks to the > userland, leading to countless errors when that single star is missing. If you miss single dollar, comma or = sign, there could be errors too. So? > 4. every IDE or code-highlighting prints them in light grey, making them > sort of invisible. Fix your IDE. My IDE knows about what phpdoc tags are :) Some IDEs lagging behind is not an argument in language design. IDEs can be fixed. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227