Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89442 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21083 invoked from network); 26 Nov 2015 11:46:39 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Nov 2015 11:46:39 -0000 Authentication-Results: pb1.pair.com smtp.mail=pedronaroga@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=pedronaroga@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.176 as permitted sender) X-PHP-List-Original-Sender: pedronaroga@gmail.com X-Host-Fingerprint: 209.85.160.176 mail-yk0-f176.google.com Received: from [209.85.160.176] ([209.85.160.176:33517] helo=mail-yk0-f176.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 87/55-05516-D11F6565 for ; Thu, 26 Nov 2015 06:46:38 -0500 Received: by ykdv3 with SMTP id v3so87169209ykd.0 for ; Thu, 26 Nov 2015 03:46:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4SJ+sM2Fph049gRY6y8v/IFkCIj57iTJXxCSYPbyerY=; b=WjEs62p32MUMM1MyeL74Te1Tgei/OJn5OJjbpgvI9+TdfU0tNDgnpxTHWvpS/wv/m3 KUi76gzbvKMiVY3rXRF+neQsKqOiK9B0QWs1MqPrM0HL3GI0d6uAGTLMYms3qp6YLKev fSSXw+NjZEU/sxhZHrYTc3AXqh0B90qxhkLPi7NAhQ9GXXIwNAKDz23OBxBsCTqzElS2 uIh8rwoCjXeKqft4VbjNVg/pTEa+uH6kZjn+mIJ6hNgEoYEnPNUzV+iq5BC/3qRfxojT p41s5Wvd8J87x/VI1M0aAOdWmFaN4d6JgAMR7mapNWom/UgWQfmPI2shkyOFJRCfx3FD woVA== MIME-Version: 1.0 X-Received: by 10.13.215.20 with SMTP id z20mr1018718ywd.304.1448538394495; Thu, 26 Nov 2015 03:46:34 -0800 (PST) Received: by 10.37.202.9 with HTTP; Thu, 26 Nov 2015 03:46:34 -0800 (PST) In-Reply-To: <5656D99F.10707@gmail.com> References: <5654B516.4020700@gmail.com> <5655D82A.8020304@lsces.co.uk> <5655E4E4.8070200@garfieldtech.com> <5655E61E.3000904@gmail.com> <5655E93F.90506@gmail.com> <5655F24B.6020401@garfieldtech.com> <5655F47C.3060504@gmail.com> <1B1E6CD7-2378-43CA-A636-83383707AF8E@gmail.com> <5656D99F.10707@gmail.com> Date: Thu, 26 Nov 2015 09:46:34 -0200 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary=94eb2c076366729a720525702009 Subject: Re: [PHP-DEV] Native Annotation Syntax From: pedronaroga@gmail.com (Pedro Cordeiro) --94eb2c076366729a720525702009 Content-Type: text/plain; charset=UTF-8 Hi, Rowan. I'll respond to some points that have become recurrent. 1) It's might not be objectively bad to add this feature in docblocks, but it will be objectively wrong to keep calling them "DocBlocks" if they are no longer documentation-only blocks. 2) Even though PHP already treats docblocks differently from comments, that's not the common view on userland, nor is explained on the manuals. There are no separate entries to explain docblocks, and no mention to them on the "Comments" page. The Reflection method to retrieve DocBlocks is "getDocCOMMENT", which suggests they are comment that do not affect runtime behaviour. We'd have to update the comments page to say "'/*' starts a comment, unless if they're immediately followed by another asterisk ('/**'), in which case it may or may not be a comment, depends on the following token". It's very confusing. 3) To make this work within docblocks, we'd have to get rid of at least one configuration setting (opcode.save_comments). 4) You've suggested disregarding docblock stripping from transpilers and obfuscators, because they are not first-class citizens, even though those are part of the PHP ecosystem and affect users. 5) We'd have a harder time making decisions on syntax for docblocks, because there are already multiple different implementations, and because people will have a hard time agreeing on some points, like the one guilherme made about the asterisks (*) or spaces being part of multiline annotation or not. Whereas none of these points are issues for a native syntax outside docblocks, because it'd be a completely different feature that would reside in new syntax, not in modification of current syntax. 2015-11-26 8:06 GMT-02:00 Rowan Collins : > guilhermeblanco@gmail.com wrote on 26/11/2015 01:13: > >> Ok, so I'll explain why it's not "the same way" as you imagine. >> >> I've heard this many times already so I'll save you keystrokes. >> - "Sure, we can do that on docblocks" >> - "Based on that, it doesn't need to be part of core and can safely be >> implemented as a PECL extension" >> >> > OK, as far as everything I was talking about, this is all rather a straw > man, but perhaps that's just a miscommunication on my part, so let me clear > that up: > > I have never suggested, and would not support a suggestion, that this be > implemented as an extension. I can absolutely see the advantage to having a > first-class syntax, baked into the main parser. > > With that out of the way, we are back to the main point I was trying to > make which is that that syntax could, if we wanted, live inside the context > of /** */ blocks, which are already treated differently from comments. The > parsing problems within that context are very similar to the parsing > problems in any other context (again, assuming that this is being > implemented directly in the core parser, not in any kind of extension). > > So, the pros and cons of that are not to do with the parsing but to do > with: > - potential compatibility with existing code, which may be tricky as there > is no standard to base the feature on > - the ability to polyfill code in older PHP versions, which is useful but > not something we have aimed for with previous features > - on the other side, the perception that docblocks are "just comments", > which would be hard to dispel even if we renamed them "metadata blocks" > > Anyway, I apologise for drawing out this part of the discussion for so > long. I actually think it's just one of many decisions that needs making > before this feature can be attempted, probably starting with just what an > annotation consists of - is it a label with some text attached? a resolved > class name with parsed PHP code passed to its constructor (some people have > mentioned arrays and heredocs as parameters to annotations)? somewhere > between the two? > > > Regards, > -- > Rowan Collins > [IMSoP] > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --94eb2c076366729a720525702009--