Re: [RFC] Attributes v2

From: Date: Tue, 10 Mar 2020 15:04:23 +0000
Subject: Re: [RFC] Attributes v2
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-108953@lists.php.net to get a copy of this message
> On Mar 10, 2020, at 7:53 AM, Aleksander Machniak <alec@alec.pl> 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"), >>>> \My\Attributes\FewArguments("foo", "bar") {} >>>> >>> >>> This particular example leads to complications with how different keywords >>> stack up; would the return statement come before the "attributes" keyword? >> >> How does the return statement affect this example? The return statement would be inside >> the braces, the attributes would be before the braces. > > I think he meant return type declaration. That's why the question about > the use clause is as well relevant. If that is the case that makes a little more sense. But even so, the question is surprising because we have a well established existing pattern with extends and implements clauses, for example: function foo():returntype extends Parent implements Interface1, Interface2, Interface2 attributes Attribute1, Attribute2, Attribute3 {} -Mike

« previous php.internals (#108953) next »