Re: [PHP-DEV] [RFC] Attributes v2

2020-03-12 Thread Rowan Tommins
On Thu, 12 Mar 2020 at 03:14, Mike Schinkel wrote: > > The way I was thinking of it, and I think the way this RFC is drafted, > the native attributes would - at least initially - be a very low-level > feature, with libraries expected to build more useful functionality on top. > So if a library ga

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Mike Schinkel
> On Mar 11, 2020, at 5:36 PM, Rowan Tommins wrote: > > On 11/03/2020 19:12, Mike Schinkel wrote: >> My gut feeling is that attributes should be specific to the classes in which >> they are declared. But I see no reason a "must-add" requirement for >> attributes where the requirement is passed

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Rowan Tommins
On 11/03/2020 19:12, Mike Schinkel wrote: My gut feeling is that attributes should be specific to the classes in which they are declared. But I see no reason a "must-add" requirement for attributes where the requirement is passed down to a concrete class needs to be coupled to a inheritance of

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Mike Schinkel
> On Mar 11, 2020, at 1:39 PM, Rowan Tommins wrote: > > On Wed, 11 Mar 2020 at 14:18, Mike Schinkel wrote: > >> >> IOW, if interfaces cannot enforce the requirements of the "contract" why >> have interfaces? Why not just use method_exisits() when we need to call a >> prescribed method? >>

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Rowan Tommins
On Wed, 11 Mar 2020 at 14:18, Mike Schinkel wrote: > > IOW, if interfaces cannot enforce the requirements of the "contract" why > have interfaces? Why not just use method_exisits() when we need to call a > prescribed method? > Interfaces, at least as implemented by languages such as PHP and Ja

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Dan Ackroyd
On Wed, 11 Mar 2020 at 14:18, Mike Schinkel wrote: > if interfaces cannot enforce the requirements of the "contract" why have > interfaces? Because they are a useful tool, and cover a lot of people's use-cases. But most people who use doc block annotations currently don't seem to have a need fo

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Mike Schinkel
> On Mar 10, 2020, at 5:03 PM, Benjamin Eberlei wrote: Thank you for answering again. On Tue, Mar 10, 2020 at 9:41 PM Mike Schinkel wrote: -Mike P. S. Did you see the question on interfaces? >>> No I missed it. Attributes work on interfaces, but they are not inherited >>> to par

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-11 Thread Alexandru Pătrănescu
Hi Benjamin, Two small issues/questions: 1. It is not allowed to use the same attribute name more than once on the same declaration and a compile error is thrown when this detected. Is there any reason for this? IMO, the attribute can represents something that can have multiple options. Like an `

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Benjamin Eberlei
On Tue, Mar 10, 2020 at 9:41 PM Mike Schinkel wrote: > > On Mar 10, 2020 at 3:49 PM, > > wrote: > > On Tue, Mar 10, 2020 at 5:30 PM Mike Schinkel wrote: > >> > On Mar 10, 2020, at 11:28 AM, Benjamin Eberlei >> wrote: >> > >> > Just to make sure you don't run in circles in this discussion thread

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> > On Mar 10, 2020 at 3:49 PM, mailto:kont...@beberlei.de)> > wrote: > > > > > > On Tue, Mar 10, 2020 at 5:30 PM Mike Schinkel (mailto:m...@newclarity.net)> wrote: > > > > On Mar 10, 2020, at 11:28 AM, Benjamin Eberlei > (mailto:kont...@beberlei.de)> wro

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Benjamin Eberlei
On Tue, Mar 10, 2020 at 5:30 PM Mike Schinkel wrote: > > On Mar 10, 2020, at 11:28 AM, Benjamin Eberlei > wrote: > > > > Just to make sure you don't run in circles in this discussion thread > here, even when syntax is not fixed yet, it's not going to be a syntax > where the attributes are suffix

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Rowan Tommins
Hi Mike, You're right that we're bikeshedding rather, but to clarify a couple of small points, and apologise on some others... On Tue, 10 Mar 2020 at 16:27, Mike Schinkel wrote: > > Saying it is a weak argument is merely opinion. > You are right, that was an unhelpful comment, and I apologis

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Ben Ramsey
> On Mar 10, 2020, at 05:54, Rowan Tommins wrote: > > On Tue, 10 Mar 2020 at 01:02, Mike Schinkel wrote: > >> >> I find angle brackets extremely hard to read >> > > > You're definitely not alone in disliking the syntax, but I think it > actually looks quite neat. It reminds me firstly of te

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> On Mar 10, 2020, at 11:28 AM, Benjamin Eberlei wrote: > > Just to make sure you don't run in circles in this discussion thread here, > even when syntax is not fixed yet, it's not going to be a syntax where the > attributes are suffixed after the declaration. It would maybe some other > chara

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> On Mar 10, 2020, at 8:33 AM, Rowan Tommins wrote: You make it really hard to just let the discussion just stand. >> Consistency with other declarations in PHP? > > I think this is generally a weak argument, because we have a mixture of > punctuation and keywords already. Saying it is a weak

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Benjamin Eberlei
On Tue, Mar 10, 2020 at 4:04 PM Mike Schinkel wrote: > > On Mar 10, 2020, at 7:53 AM, Aleksander Machniak wrote: > > > > On 10.03.2020 12:43, Mike Schinkel wrote: > Alternately, why not use this (which is probably the best option > IMO)?: > > function foo() attributes >

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Rowan Tommins
On Tue, 10 Mar 2020 at 15:04, Mike Schinkel wrote: > > I think he meant return type declaration. That's why the question about > > the `use` clause is as well relevant. > Yes, that was a typo on my part, sorry. > But even so, the question is surprising because we have a well established > ex

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> On Mar 10, 2020, at 7:53 AM, Aleksander Machniak wrote: > > On 10.03.2020 12:43, Mike Schinkel wrote: Alternately, why not use this (which is probably the best option IMO)?: function foo() attributes SingleArgument("Hello"), Another\SingleArgument("World"),

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Rowan Tommins
On Tue, 10 Mar 2020 at 11:46, Mike Schinkel wrote: > > On Mar 10, 2020, at 7:36 AM, Rowan Tommins > wrote: > > I think that applies to our case equally: any punctuation or keyword is > > just a separator between the main function declaration and the specific > > attribute being applied. Having t

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Aleksander Machniak
On 10.03.2020 12:43, Mike Schinkel wrote: >>> Alternately, why not use this (which is probably the best option IMO)?: >>> >>> function foo() attributes >>>SingleArgument("Hello"), >>>Another\SingleArgument("World"), >>>\My\Attributes\FewArguments("foo", "bar") {} >>> >> >> T

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> On Mar 10, 2020, at 7:36 AM, Rowan Tommins wrote: > I think that applies to our case equally: any punctuation or keyword is > just a separator between the main function declaration and the specific > attribute being applied. Having to write "attribute Sealed" would be like > having to write "vis

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Mike Schinkel
> On Mar 10, 2020, at 6:54 AM, Rowan Tommins wrote: >> and fear — have trained many newbies in programming — that it will cause >> newbies who see PHP to think it is too complex for them to consider >> learning. > > I think the *concept* of attributes carries a much higher risk of that than > any

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Rowan Tommins
On Tue, 10 Mar 2020 at 10:54, Rowan Tommins wrote: > > C#: [Foo] > Rust: #![Foo] or #[Foo] > C++: [[Foo]] > Java: @Foo > ECMAScript (proposed): @Foo > Go: `Foo` or "Foo" > Doctrine et al: /** @Foo */ > Hack: <> > > To add to that list, Python decorators, which serve a similar purpose, also use @

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-10 Thread Rowan Tommins
On Tue, 10 Mar 2020 at 01:02, Mike Schinkel wrote: > > I find angle brackets extremely hard to read > You're definitely not alone in disliking the syntax, but I think it actually looks quite neat. It reminds me firstly of templating languages which use {{foo}} for placeholders and/or keywords,

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Saif Eddin Gmati
Really excited to see the discussion about this feature being brought up again, thanks for working on this :) One thing I would suggest is to add a base interface `Attribute` and multiple sub-interfaces such as `ClassAttribute`, `MethodAttribute`, and `PropertyAttribute` just like hack lang (

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Sebastian Bergmann
Am 09.03.2020 um 20:16 schrieb Matthew Brown: I think the syntax here looks great, and I think this would be an exciting addition to the language. I want to build things with it! I could not have written better words :) -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, vi

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Mike Schinkel
> On Mar 10, 2020, at 12:24 AM, Matthew Brown wrote: > > I would not expect someone who’s never written a line of code to understand > attributes/decorators, just as I wouldn’t expect them to understand traits, > interfaces, or really any of the things one should know about in order to > write

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Matthew Brown
I would not expect someone who’s never written a line of code to understand attributes/decorators, just as I wouldn’t expect them to understand traits, interfaces, or really any of the things one should know about in order to write and maintain production-ready PHP code. If you want someone to

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Mike Schinkel
> On Mar 9, 2020, at 9:36 PM, Matthew Brown wrote: > > Saying "the syntax makes my eyes bleed" is slightly useless feedback. That was just a header. There was elaboration right below it: "I find angle brackets extremely hard to read and fear — having trained many newbies in programming — that

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Matthew Brown
Saying "the syntax makes my eyes bleed" is slightly useless feedback. You could say "it's hard to scan", but I don't even think that's true – prepending everything << makes it easy to pick out attributes in plain text at a glance, and one can assume that IDEs will help even further. Additionally

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Mike Schinkel
> On Mar 9, 2020, at 10:42 AM, Benjamin Eberlei wrote: > > Hi all, > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > 2016 with a few changes, incorporating feedback from the mailing list back > then and from talking to previous no voters. > > The RFC is at https://wi

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 11:03 PM Larry Garfield wrote: > On Mon, Mar 9, 2020, at 9:42 AM, Benjamin Eberlei wrote: > > Hi all, > > > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > > 2016 with a few changes, incorporating feedback from the mailing list > back > > then an

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Larry Garfield
On Mon, Mar 9, 2020, at 5:02 PM, Larry Garfield wrote: > On Mon, Mar 9, 2020, at 9:42 AM, Benjamin Eberlei wrote: > > Hi all, > > > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > > 2016 with a few changes, incorporating feedback from the mailing list back > > then and

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Larry Garfield
On Mon, Mar 9, 2020, at 9:42 AM, Benjamin Eberlei wrote: > Hi all, > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > 2016 with a few changes, incorporating feedback from the mailing list back > then and from talking to previous no voters. > > The RFC is at https://wiki

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Saif Eddin Gmati
Really excited to see the discussion about this feature being brought up again, thanks for working on this :) One thing I would suggest is to add a base interface `Attribute` and multiple sub-interfaces such as `ClassAttribute`, `MethodAttribute`, and `PropertyAttribute` just like hack lang (

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 8:29 PM Robert Hickman wrote: > > > The RFC is at https://wiki.php.net/rfc/attributes_v2 > > > > > > A working patch is at https://github.com/beberlei/php-src/pull/2 > though > > > work around the details is still necessary. > > > > > > The RFC contains a section with commo

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 5:34 PM Paul M. Jones wrote: > Hi Benjamin, > > From the examples, am I to understand that the RFC introduces a top-level > namespace `\Php` ? > > Honestly didn't realize this and thought PhpToken would already be in the PHP namespace. I am going to think this over and prob

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 8:35 PM Aleksander Machniak wrote: > On 09.03.2020 15:42, Benjamin Eberlei wrote: > > The RFC is at https://wiki.php.net/rfc/attributes_v2 > > Would it make sense to support this: > > <> > <> > <> > function foo() {} > > in this form: > > << > WithoutArgument; // commen

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread David Rodrigues
Another doubt: in relation to the PR ( https://github.com/beberlei/php-src/pull/2) it is called as "attributes", but seems better keep as "annotations". The Doctrine annotations is based in PHPDoc, are not? And it is basically the same thing, and annotations term is used in other languages. And to

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Aleksander Machniak
On 09.03.2020 15:42, Benjamin Eberlei wrote: > The RFC is at https://wiki.php.net/rfc/attributes_v2 Would it make sense to support this: <> <> <> function foo() {} in this form: << WithoutArgument; // comments allowed here SingleArgument(0); FewArguments('Hello', 'World'); >> functi

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Robert Hickman
> > The RFC is at https://wiki.php.net/rfc/attributes_v2 > > > > A working patch is at https://github.com/beberlei/php-src/pull/2 though > > work around the details is still necessary. > > > > The RFC contains a section with common criticism and objections to > > attributes, and I hope to have coll

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Matthew Brown
For information that's needed at runtime (as opposed to documentation or static analysis) docblocks have an obvious overh I think the syntax here looks great, and I think this would be an exciting addition to the language. I want to build things with it! On Mon, 9 Mar 2020 at 10:43, Benjamin Eber

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 6:18 PM Rowan Tommins wrote: > Hi Benjamin > > On Mon, 9 Mar 2020 at 14:43, Benjamin Eberlei wrote: > > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > > 2016 with a few changes, incorporating feedback from the mailing list > back > > then and f

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Rowan Tommins
Hi Benjamin On Mon, 9 Mar 2020 at 14:43, Benjamin Eberlei wrote: > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > 2016 with a few changes, incorporating feedback from the mailing list back > then and from talking to previous no voters. > > The RFC is at https://wiki.ph

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Paul M. Jones
Hi Benjamin, From the examples, am I to understand that the RFC introduces a top-level namespace `\Php` ? -- Paul M. Jones pmjo...@pmjones.io http://paul-m-jones.com Modernizing Legacy Applications in PHP https://leanpub.com/mlaphp Solving the N+1 Problem in PHP https://leanpub.com/sn1php -

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Stephen Reay
> On 9 Mar 2020, at 23:27, Benjamin Eberlei wrote: > > > > On Mon, Mar 9, 2020 at 5:18 PM Stephen Reay > wrote: > > > > On 9 Mar 2020, at 21:42, Benjamin Eberlei > > wrote: > > > > Hi all, > > > > I want to resurrect Dmitrys A

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
On Mon, Mar 9, 2020 at 5:18 PM Stephen Reay wrote: > > > > On 9 Mar 2020, at 21:42, Benjamin Eberlei wrote: > > > > Hi all, > > > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > > 2016 with a few changes, incorporating feedback from the mailing list > back > > then an

Re: [PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Stephen Reay
> On 9 Mar 2020, at 21:42, Benjamin Eberlei wrote: > > Hi all, > > I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in > 2016 with a few changes, incorporating feedback from the mailing list back > then and from talking to previous no voters. > > The RFC is at https://wik

[PHP-DEV] [RFC] Attributes v2

2020-03-09 Thread Benjamin Eberlei
Hi all, I want to resurrect Dmitrys Attributes RFC that was rejected for 7.1 in 2016 with a few changes, incorporating feedback from the mailing list back then and from talking to previous no voters. The RFC is at https://wiki.php.net/rfc/attributes_v2 A working patch is at https://github.com/be