Re: Renaming PhpAttribute to Attribute
| From: | Marco Pivetta | Date: | Tue, 28 Apr 2020 15:42:54 +0000 |
| Subject: | Re: Renaming PhpAttribute to Attribute | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-109881@lists.php.net to get a copy of this message | ||
Heya,
On Tue, Apr 28, 2020 at 5:37 PM 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.
>
Attribute is certainly too generic, and will needlessly collide with code
in the wild.
I suggest circling back to the PHP\ namespace discussion, and having
PHP\Attribute if you really have a problem with current naming.
Otherwise, we will indeed see more and more
the_php_way_<actual-name-of-symbol> in future :-)
Marco Pivetta
http://twitter.com/Ocramius
http://ocramius.github.com/