Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89417 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 36782 invoked from network); 25 Nov 2015 17:07:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Nov 2015 17:07:01 -0000 Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.26 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.26 out2-smtp.messagingengine.com Received: from [66.111.4.26] ([66.111.4.26:57234] helo=out2-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5F/53-19088-4BAE5565 for ; Wed, 25 Nov 2015 12:07:01 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 392D320D02 for ; Wed, 25 Nov 2015 12:06:58 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute2.internal (MEProxy); Wed, 25 Nov 2015 12:06:58 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=YaN/AFgf34HmhKB vNq+YjsVVoWA=; b=agBXbt1D/lKOwKS2Sqho/Bfyqk75A8XcXlarEYpjUkWqAIW /naj5UCt8TvY5GkyK3yNSwmo6/S3fwt0eRlD0x9Ec1J1dCvt9XTU4F+AMCYcIVja 7YXfRYrGXfdiC9lCz+YRiHk0358xqTNP8RjL3zXc2ZOtaMPuMYndXh3dXc4E= X-Sasl-enc: byMFFDhlfU462BQCZskHOD3gv5JufCkgiDPPtTwahujV 1448471217 Received: from Crells-MacBook-Pro.local (unknown [63.250.249.138]) by mail.messagingengine.com (Postfix) with ESMTPA id D349F6800FD for ; Wed, 25 Nov 2015 12:06:57 -0500 (EST) To: internals@lists.php.net References: <5654B516.4020700@gmail.com> <5655D82A.8020304@lsces.co.uk> <5655E4E4.8070200@garfieldtech.com> <5655E61E.3000904@gmail.com> Message-ID: <5655EAB1.2080507@garfieldtech.com> Date: Wed, 25 Nov 2015 11:06:57 -0600 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 MIME-Version: 1.0 In-Reply-To: <5655E61E.3000904@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Native Annotation Syntax From: larry@garfieldtech.com (Larry Garfield) On 11/25/15 10:47 AM, Rowan Collins wrote: > Larry Garfield wrote on 25/11/2015 16:42: >> However, doing so would make static checking more difficult; If >> annotations become a language-native feature, they should be a >> first-class citizen to make it easier for IDEs to handle. > > Could you explain why docblocks are harder to parse than text outside > docblocks? As far as I know, IDEs *already* parse docblocks, e.g. > using @param and @return for type analysis, so I don't really see why > generalising that would be a big problem. Not being an IDE author I cannot say for certain, so perhaps it's easier than I imagine. However, speaking as a user I would want a robust level of static syntax validation of my annotations. Having robust syntax validation show up in *some* parts of my docblock but not others is confusing for me as a user; I hypothesize that it would similarly be more difficult to selectively treat bits and pieces of the docblock as code but not others. (My current IDE, PHPStorm, parses a docblock to validate that it matches the method signature but all it does is tell me if the whole thing is valid or not, and if I'm using a "used" class name. It's actually very unhelpful when dealing with complex Doctrine annotations like Drupal uses.) Too, it means that a given annotation directive may have spurious * characters inside its string, if it's multi-line. Sure, that can be filtered out (Doctrine already does), but that's one more complication to have to consider. For me, the "sometimes it's code and sometimes it's not, even though it looks the same" argument is sufficient to reject docblocks as a location for annotations. -- --Larry Garfield