Re: [RFC] Shorter Attribute Syntax Change RFC 0.2
| From: | Peter Bowyer | Date: | Wed, 19 Aug 2020 09:36:09 +0000 |
| Subject: | Re: [RFC] Shorter Attribute Syntax Change RFC 0.2 | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111629@lists.php.net to get a copy of this message | ||
On Wed, 19 Aug 2020 at 09:46, Jordi Boggiano <j.boggiano@seld.be> wrote:
> Just to mention something here in a bit more depth because it is easy to
> overlook in the RFC if you have looked at it a lot.
>
> In "Potential Future Benefits of Enclosed Delimiter Syntax" there is an
> addition of an example using an attribute for an AOP-style
> before-function callback:
>
> @:Before(fn ($x) => $x*4)
>
> IMO this is much more readable and self-documenting than a dangling
> lambda like @[fn ($x) => %x*4], as the attribute name hints at what is
> going on, and it provides enclosure with the arg list ().
>
I read a lot of code I didn't write, and I like your example. It is much
more readable and self-documenting.
Peter