Re: [RFC] Attributes v2

From: Date: Mon, 09 Mar 2020 20:43:04 +0000
Subject: Re: [RFC] Attributes v2
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-108927@lists.php.net to get a copy of this message
On Mon, Mar 9, 2020 at 8:29 PM Robert Hickman <robehickman@gmail.com> 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 common criticism and objections to > > > attributes, and I hope to have collected and responded to a good amount > > > already from previous discussions. > > > > > Why do decorator names refer to classes, rather than any callable as in > python? > Decorators in Python work differently (to my understanding) that the following function declartion @foo def bar(): At runtime becomes foo(bar()); PHPs Attributes do not become runtime behavior, instead they allow the Reflection API to access the attributes as metadata. As such declaring a callable doesn't make sense, because an attribute is not a callable, it is (meta-)data.

« previous php.internals (#108927) next »