Re: Renaming PhpAttribute to Attribute
| From: | Aaron Piotrowski | Date: | Tue, 28 Apr 2020 16:20:46 +0000 |
| Subject: | Re: Renaming PhpAttribute to Attribute | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109887@lists.php.net to get a copy of this message | ||
> On Apr 28, 2020, at 10:37 AM, Benas IML <benas.molis.iml@gmail.com> wrote:
>
> Hey internals,
>
> Since it's safe to say that the Attributes v2 RFC has passed, I wanted to
> make a separate thread based on the comment by Rowan Tommins in the PHP
> namespace policy thread. This is a quote from his comment:
>
>> One prefix doesn't make a trend. "PhpToken" is a different case - it's
>> a
>> token of PHP source code, so the prefix isn't anything to do with
>> avoiding name collisions, it's a natural clarification.
>>
>> To be honest, I'd be perfectly happy with the attributes RFC using the
>> class name "Attribute", just as we use "Iterator", "Closure",
>> "Exception", etc, etc. At which point the whole thing's a non-issue.
>
> I do strongly agree with him and I believe we should rename
>
\PhpAttribute
> to simply \Attribute before the PHP 8 release in order to
> improve
> consistency with other classes and interfaces e. g. Iterator, ArrayAccess,
> Countable. It would also make the attribute class definition look more
> aesthetically pleasing:
>
> ```
> <?php
> <<Attribute>>
> class Test {}
> ```
>
> I am ready to make an RFC for this if the replies are mostly positive, so
> please, express your opinions!
>
> Best regards,
> Benas Seliuginas
> P.S: this is my second email account so hopefully it won't get marked as
> spam.
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I too strongly agree that attributes should use Attribute over
PhpAttribute or even PHP\Attribute.
Namespaces for bundled classes probably should be used in the future, but for logically grouped
classes (such as DOM), extensions, etc.
Attributes are a basic language feature, and therefore should live in the global namespace the same
way as Throwable, Iterator, Countable, etc.
I did not want naming to be a blocker on the attributes RFC, but it certainly bothered me that it
was not <<Attribute>>.
Please put together an RFC for this name change, I would definitely vote yes.
Regards,
Aaron Piotrowski