Re: [PHP-DEV] [RFC] Amendments to Attributes

This is only part of a thread. view whole thread
  110220
May 20, 2020 17:53 ben@benramsey.com (Ben Ramsey)
> On May 20, 2020, at 12:07, Benjamin Eberlei <kontakt@beberlei.de> wrote: > > 2. Rename PhpAttribute to Attribute in global namespace (independent of the > namespace RFC)
I suggested in a previous thread that we consider renaming `PhpAttribute` to `UserlandAttribute`, since this is the intent of the attribute, and it helps distinguish it from `CompilerAttribute`. I noticed that the compiler attribute is actually named `PhpCompilerAttribute`, so unless we change its name to `CompilerAttribute`, I don’t think it makes sense to change `PhpAttribute` to `Attribute`. Perhaps we change it to `PhpUserlandAttribute`, for clarity? Cheers, Ben
  110221
May 20, 2020 18:33 benas.molis.iml@gmail.com (Benas IML)
Hey,

I personally think that `UserlandAttribute` is too verbose and a quite
useless change since just using `Attribute` will make little to no BC
compatibility breaks (we know that thanks to Rowan, please check out
Renaming PhpAttribute thread) and would also sound more natural. This would
also mean that we would rename `PhpCompilerAttribute` to simply
`CompilerAttribute`.


Best regards,
Benas Seliuginas
  110225
May 20, 2020 22:13 kontakt@beberlei.de (Benjamin Eberlei)
On Wed, May 20, 2020 at 7:53 PM Ben Ramsey <ben@benramsey.com> wrote:

> > On May 20, 2020, at 12:07, Benjamin Eberlei <kontakt@beberlei.de> wrote: > > > > 2. Rename PhpAttribute to Attribute in global namespace (independent of > the > > namespace RFC) > > > I suggested in a previous thread that we consider renaming `PhpAttribute` > to `UserlandAttribute`, since this is the intent of the attribute, and it > helps distinguish it from `CompilerAttribute`. > > I noticed that the compiler attribute is actually named > `PhpCompilerAttribute`, so unless we change its name to > `CompilerAttribute`, I don’t think it makes sense to change `PhpAttribute` > to `Attribute`. Perhaps we change it to `PhpUserlandAttribute`, for clarity? >
Ah that's a good point that still needs to be clarified. We realized that PhpAttribute and PhpCompilerAttribute should be merged, because the difference doesn't make a difference to userland code and it complicates things. For example enforcing that PhpCompilerAttribute is just on internal classes would not work for generated stub code in Phan/Psalm and so on that "describe" internal code by imitating it in userland. This would not be allowed by the current implementation and lead to a compiler error, lets say if we imitated Deprecated for documentation purposes: > class Deprecated {} This file could not be compiled by current implementation as an error would prevent Userland Deprecated class from using PhpCompilerAttribute.
> > Cheers, > Ben >
  110229
May 21, 2020 06:06 me@jhdxr.com (=?utf-8?b?Q0hVIFpoYW93ZWk=?=)
Hi Benjamin,

It's good to hear that `PhpCompikerAttribute` can be merged, could you include it in the RFC as well? Thus I think people who support `UserlandAttribute` can agree with `Attribute` now as well.

Regards,
CHU Zhaowei

-----Original Message-----
From: Benjamin Eberlei <kontakt@beberlei.de> 
Sent: Thursday, May 21, 2020 6:13 AM
To: Ben Ramsey <ben@benramsey.com>
Cc: PHP Internals <internals@lists.php.net>
Subject: Re: [PHP-DEV] [RFC] Amendments to Attributes

On Wed, May 20, 2020 at 7:53 PM Ben Ramsey <ben@benramsey.com> wrote:

> > On May 20, 2020, at 12:07, Benjamin Eberlei <kontakt@beberlei.de> wrote: > > > > 2. Rename PhpAttribute to Attribute in global namespace (independent > > of > the > > namespace RFC) > > > I suggested in a previous thread that we consider renaming > `PhpAttribute` to `UserlandAttribute`, since this is the intent of the > attribute, and it helps distinguish it from `CompilerAttribute`. > > I noticed that the compiler attribute is actually named > `PhpCompilerAttribute`, so unless we change its name to > `CompilerAttribute`, I don’t think it makes sense to change > `PhpAttribute` to `Attribute`. Perhaps we change it to `PhpUserlandAttribute`, for clarity? >
Ah that's a good point that still needs to be clarified. We realized that PhpAttribute and PhpCompilerAttribute should be merged, because the difference doesn't make a difference to userland code and it complicates things. For example enforcing that PhpCompilerAttribute is just on internal classes would not work for generated stub code in Phan/Psalm and so on that "describe" internal code by imitating it in userland. This would not be allowed by the current implementation and lead to a compiler error, lets say if we imitated Deprecated for documentation purposes: > class Deprecated {} This file could not be compiled by current implementation as an error would prevent Userland Deprecated class from using PhpCompilerAttribute.
> > Cheers, > Ben >
  110234
May 21, 2020 15:16 ben@benramsey.com (Ben Ramsey)
> On May 21, 2020, at 01:06, CHU Zhaowei <me@jhdxr.com> wrote: > > It's good to hear that `PhpCompikerAttribute` can be merged, could you include it in the RFC as well? Thus I think people who support `UserlandAttribute` can agree with `Attribute` now as well.
I think I’m the only one who supports `UserlandAttribute`. :-) Yes, if these two are merged, then naming it `Attribute` is okay with me, since there won’t be any confusion with the names and naming schemes. Cheers, Ben