Re: [RFC] Attributes v2
| From: | Benjamin Eberlei | Date: | Tue, 10 Mar 2020 15:28:04 +0000 |
| Subject: | Re: [RFC] Attributes v2 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-108955@lists.php.net to get a copy of this message | ||
On Tue, Mar 10, 2020 at 4:04 PM Mike Schinkel <mike@newclarity.net> wrote:
> > 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 {}
>
> 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
characters like %[Attr].
> -Mike
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>