Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93218 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18061 invoked from network); 11 May 2016 09:02:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2016 09:02:22 -0000 Authentication-Results: pb1.pair.com smtp.mail=kontakt@beberlei.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=kontakt@beberlei.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain beberlei.de from 74.125.82.50 cause and error) X-PHP-List-Original-Sender: kontakt@beberlei.de X-Host-Fingerprint: 74.125.82.50 mail-wm0-f50.google.com Received: from [74.125.82.50] ([74.125.82.50:37616] helo=mail-wm0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/A4-28272-B15F2375 for ; Wed, 11 May 2016 05:02:21 -0400 Received: by mail-wm0-f50.google.com with SMTP id a17so70213569wme.0 for ; Wed, 11 May 2016 02:02:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=beberlei-de.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=EzW1Ndcqq35LNOpxnskZdaUS/FMzzxpZcVMKf/Ec/4E=; b=QEg4ZNsPcwzBfx0Ykg4A/kogmxWZPswanMcFGIvYJ1NsBlUeOmzMTkTX/DOnCZIm4h q1cO2P0lVG8Rr9vN5/TACNx9DchhRXrCum31+EUic3mVxDkpX5AArQPjnmzg5b4i0RGl T4UTblaH4+znTj4g9f00WA7DiIHxJCR4L6TWOIvJ1eh3z3GypS2QFOMUn3Cn5aK2iXCv mHJ5x1sVn9EPMfyGeVLEUsG34oHO81246KEMcIdP9fiDlRI1BgilF+V7plONJNa4pIcG C8KrIBZZB3MDd3oR/GdQ+Ma0xehlagsugQ6USg86IJ7vxjpZxaZHcPSS1aDHw5eeYu2V CsZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=EzW1Ndcqq35LNOpxnskZdaUS/FMzzxpZcVMKf/Ec/4E=; b=JFCwp97iKQeVc/PL/c9mW/dCWdV1IiStMXCZZ4pRLLKceq2oZRk0oJ6jDtMciNXvXM AaZYoWY2ftL8TNMrxGGqCRclxmsNvF0I7cgv85HOYjeQ3rEMK7Rmmm+vC+YzAginOuDf 0AR4Dt3TDkaQejq6IQWYtBlTASMTHZCT9+iH0UaFe5bCsAsLDfEACqlHTuCMip5IECyC /VhkcaBmFum17fZvogowhjf3bP8Dhfjrw2+3beN/PsGNUvBYjlByfBnRyvGtPeF397oE 8zTgzfe4qPmiCBw/e+ScdxPz2TStlWWa0YBzDfPfonJZYBAVVeO8epBdJYOtF05Wfc6D 0OwA== X-Gm-Message-State: AOPr4FVUDjQQ87W1CKYHepKg6A+lVgpPWdk1ana3QtwiZDqNowFeW6FiWjHSNhG8zEqKkxlRs5tm729WdklRYw== MIME-Version: 1.0 X-Received: by 10.28.94.193 with SMTP id s184mr2839883wmb.57.1462957337435; Wed, 11 May 2016 02:02:17 -0700 (PDT) Received: by 10.194.94.163 with HTTP; Wed, 11 May 2016 02:02:17 -0700 (PDT) X-Originating-IP: [77.11.22.94] In-Reply-To: References: <8d5d1c42-832d-4406-6bb5-dbf3fc02c364@telia.com> <95ccaf31-11de-8efb-13ba-038d36a6c466@zend.com> <001d497d-0117-b337-422b-7192cbed3070@zend.com> Date: Wed, 11 May 2016 11:02:17 +0200 Message-ID: To: Joe Watkins Cc: Dmitry Stogov , =?UTF-8?Q?Bj=C3=B6rn_Larsson?= , PHP internals Content-Type: multipart/alternative; boundary=001a1147145c6b97d905328d4c81 Subject: Re: [PHP-DEV] [RFC] [VOTE] PHP Attributes From: kontakt@beberlei.de (Benjamin Eberlei) --001a1147145c6b97d905328d4c81 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, May 11, 2016 at 10:42 AM, Joe Watkins wrote= : > Dmitry, > > > Except the fact, that doc-comment content don't have to conform to any > rules > > Nor does an attributes value that is just a string, that isn't validated = by > compiler ... it doesn't *have* to conform to any rules. > > That's exactly what people are voting for though, that seems to be what > people want :s > > I desperately do not want that. I don't see the remarkable difference > (although there is obviously difference) between attributes that are just > strings or constant values and doc comments. > > > and you have to parse it and extract the necessary part of meta > information every time you need it. > > You know that's not really true, there are already hooks and mechanisms t= o > "compile" strings in doc comments, I used them literally yesterday ... > > I used them in anticipation that we would get a superior solution some ti= me > soon ... it now looks like we will not :( > > I don't want to invent ways to parse code, or extract it from anywhere ..= . > we have a whole engine, an entire folder of code dedicated to that, it is > nonsensical not to utilize it. > Yes agree. I have to admit not to have read the RFC with my full attention before, i would have spotted this otherwise. I would really love to have attributes being arbitrarily nested arrays in addition to just a list of strings and have the PHP parser recognize, parse and validate that its correct. <> getAttributes() returns ["ORM\Entity" =3D> "User"] ^ This is a very simple example from the RFC, but next to the very complex Drupal example, there are rather "lightweight" usages that make up the majority of Annotations in Docblocks right now. I would like to see: < "MyApp\UserRepository", "table" =3D> "users")>> getAttributes() returns ["ORM\Entity" =3D> ["repositoryClass" =3D> "MyApp\UserRepository", "table" =3D> "users"]] The example from Drupal parsing the AST Nodes in the RFC nodes is extremely complex code and would lead again to hundrets of slightly different implementations and no standardization around them. Essentially re-implementing the PHP Parser in PHP on top of ast\nodes is not really what 80% of the users need here, which is arbitrary metadata (east way to represented in PHP as array). > > Cheers > Joe > > > > On Wed, May 11, 2016 at 8:11 AM, Dmitry Stogov wrote: > > > > > > > On 05/11/2016 09:57 AM, Joe Watkins wrote: > > > > Dmitry, > > > > > but it's possible to get the same power translating string values of > > attributes into AST in the hooks. > > > > Aware. > > > > Enough of the complexity is already the responsibility of the consumer = of > > the attributes. > > > > It's already possible to get strings (and so AST) from doc comments, we > > don't need anything new if that's all you want to do. > > > > Essentially, moving something from doc comments to <> makes zero > > sense to me. > > > > > > Except the fact, that doc-comment content don't have to conform to any > > rules, and you have to parse it and extract the necessary part of meta > > information every time you need it. It's not a big problem to do this > using > > Doctrine library, but how are you going to do this in a compiler hook? > > > > > > > > Cheers > > Joe > > > > On Wed, May 11, 2016 at 7:45 AM, Dmitry Stogov wrote: > > > >> > >> > >> On 05/11/2016 09:02 AM, Joe Watkins wrote: > >> > >> Morning Dmitry, > >> > >> > On the other hand simple string may be parsed into AST with just one > >> additional call to ast\compile_string(). > >> > >> You're not really suggesting that I write my tools in user land, are y= ou > >> ? It's me, Joe :)ce > >> > >> > >> At first days of RFC discussion Sara pointed on over-design regarding > AST. > >> I saw sense in here comments and updated RFC. > >> > >> > >> I *only* want attributes as they were originally proposed, and I can't > >> vote to reflect that. > >> > >> As discussed in private, what I want is attributes, as originally > >> proposed, and a hookable compiler; Anything else is not good enough. > >> > >> > >> Personally, I'm for AST as well, but it's possible to get the same pow= er > >> translating string values of attributes into AST in the hooks. > >> > >> Thanks. Dmitry. > >> > >> > >> > >> Cheers > >> Joe > >> > >> > >> > >> On Wed, May 11, 2016 at 6:26 AM, Dmitry Stogov < > >> dmitry@zend.com> wrote: > >> > >>> Hi Joe, > >>> > >>> The sense in native support for AST is questionable. > >>> > >>> > >>> On one hand this allows syntax verification. > >>> > >>> > >>> On the other hand simple string may be parsed into AST with just one > >>> additional call to ast\compile_string(). > >>> > >>> > >>> Thanks. Dmitry. > >>> > >>> > >>> ------------------------------ > >>> *From:* Joe Watkins > >>> *Sent:* Wednesday, May 11, 2016 7:46:09 AM > >>> *To:* Bj=C3=B6rn Larsson > >>> *Cc:* Dmitry Stogov; PHP internals > >>> *Subject:* Re: [PHP-DEV] [RFC] [VOTE] PHP Attributes > >>> > >>> Morning Dmitry, > >>> > >>> I'm not really happy with the voting options here. > >>> > >>> I would not vote in favour of a patch that does not include suppo= rt > >>> for AST, that's a completely different feature. > >>> > >>> As it is, I have to vote yes in favour of AST, but it may be > counted > >>> as a vote in favour of attributes without AST ... > >>> > >>> This doesn't seem right ... I don't want attributes without AST, > and > >>> there is no voting option to reflect that. > >>> > >>> Cheers > >>> Joe > >>> > >>> On Tue, May 10, 2016 at 11:09 PM, Bj=C3=B6rn Larsson < > >>> bjorn.x.larsson@telia.com> wrote: > >>> > >>>> Den 2016-05-11 kl. 00:00, skrev Dmitry Stogov: > >>>> > >>>>> > >>>>> > >>>>> On 05/11/2016 12:29 AM, Bj=C3=B6rn Larsson wrote: > >>>>> > >>>>>> Den 2016-05-10 kl. 20:29, skrev Dmitry Stogov: > >>>>>> > >>>>>> Hi internals, > >>>>>>> > >>>>>>> > >>>>>>> I've started voting on "PHP Attributes" RFC. > >>>>>>> > >>>>>>> > >>>>>>> > >>>>>>> https://wiki.php.net/rfc/attributes > >>>>>>> > >>>>>>> > >>>>>>> In my opinion, "PHP Attributes" might be a smart tool for PHP > >>>>>>> extension, but it's not going to be the end of the world, if we > decided to > >>>>>>> live with doc-comments only. > >>>>>>> > >>>>>>> > >>>>>>> Thanks. Dmitry. > >>>>>>> > >>>>>>> Thanks for the good work. Regarding naming, I googled > >>>>>> "PHP attributes" vs "PHP annotations" and looking at the > >>>>>> result, my view is that that Annotation is a better naming > >>>>>> then Attributes. Any hope in changing it? > >>>>>> > >>>>> > >>>>> The more I listen to arguments of adepts of existing PHP annotation > >>>>> systems, the more I think, that "PHP attributes" is the right name > for this > >>>>> proposal. > >>>>> This feature is not just for PHP annotation systems. > >>>>> > >>>> > >>>> Thats a fair point, so Annotation it's not. Still, when I hear PHP > >>>> attributes I associate it with class / function attributes. Maybe > >>>> just a question getting used to the naming. Hm, wonder if PHP > >>>> directives could have been an option? > >>>> > >>>> Regards //Bj=C3=B6rn > >>>> > >>>> > >>>> > >>>> -- > >>>> PHP Internals - PHP Runtime Development Mailing List > >>>> To unsubscribe, visit: > >>>> http://www.php.net/unsub.php > >>>> > >>>> > >>> > >> > >> > > > > > --001a1147145c6b97d905328d4c81--