> On Jul 17, 2021, at 1:40 AM, Eugene Sidelnyk <zsidel...@gmail.com> wrote:
> 
> > Having a "readonly" class where the properties are read-only by default 
> > makes sense to me, but maybe the better way to do it is with an attribute?
> 
> We already have such an attribute provided. It is called 
> [`#[Immutable]`](https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#immutable
>  
> <https://blog.jetbrains.com/phpstorm/2020/10/phpstorm-2020-3-eap-4/#immutable>).

Actually, you are confusing PhpStorm's inclusion of PhpStorm-specific userland 
attributes where the PhpStorm team are probably trying to drive 
defacto-standard meanings for those attributes they documents with attributes 
that has specific meanings and behavior recognized by PHP itself.

Nothing against PhpStorm β€” it is my IDE/editor of choice and I applaud 
JetBrain's leadership in this area β€” but their attributes are still just their 
attributes, not attributes defined by in a PHP RFC.


> If the intention is to add some logic for attributes, then unlikely it is 
> going to be accepted because attributes by definition are meta-data. It 
> doesn't add any logic for program.

Actually, that is not true either.  PHP already has one attribute that PHP 
itself recognizes, named "Attribute."  As Larry Garfield wrote[1]:  "The 
#[Attribute] attribute tells PHP β€œyes, this class can be loaded as an 
attribute.”  

You can also see that future scope was explicitly envisioned[2] that some small 
number of attributes might potentially be more than just metadata.


-Mike
[1] https://platform.sh/blog/2020/php-8-0-feature-focus-attributes/ 
<https://platform.sh/blog/2020/php-8-0-feature-focus-attributes/>
[2] https://wiki.php.net/rfc/attributes_v2#future_scope 
<https://wiki.php.net/rfc/attributes_v2#future_scope> 

Reply via email to