Hello,
I have opened the vote on the Attributes v2 RFC. The voting will be open until two weeks from now, May 4th 2020, noon UTC.
RFC: https://wiki.php.net/rfc/attributes_v2
Thank you everyone for taking part in the detailed discussion.
greetings
Benjamin
I have opened the vote on the Attributes v2 RFC. The voting will be open until two weeks from now, May 4th 2020, noon UTC.
It's unfortunate that the RFC doesn't more fully enumerate the advantages/disadvantages of the proposed syntax options.
It only points out that the T_ATTRIBUTE @: syntax is shorter and more familiar, but claims that it has the downside of not permitting whitespace in attribute names (it's not clear this is really an advantage - just an opportunity for arguments about code style).
But if you look at the pull request for the @: syntax [1], there is a much more complete comparison. For example, the <<>> syntax is more verbose, unfamiliar to most people, and even Hack seems to be moving away from it. Furthermore, because it reuses existing tokens with a different meaning, it results in expressions that can be very difficult to read. For example:
const Baz = 2;
<<FooAttribute(2 * 3 + 3)>><<Bar(4 + 5 * 2)>>
<<BarAttribute(2 * (3 + 3)>>Baz, (4 + 5) * 2)>>
function foo() {}
If PHP gets generics in the future (hopefully it does), the syntax will likely get even more confusing (if not a lot of PHP developers use shift tokens, certainly a lot more will use generics).
The @: syntax makes it much more obvious where separate attributes are being used vs. constant expressions containing a shift token:
@:FooAttribute(2 * 3 + 3)
@:Bar(4 + 5 * 2)
@:BarAttribute(2 * (3 + 3)>>Baz, (4 + 5) * 2) function foo() {}
In addition, the `@:` syntax is less verbose, and much closer to the
attribute syntax developers are familiar with using in PHPDoc comments,
as well as the syntax with precedence in other languages such as Java
and Python.
The syntax choice is very important, the language will be stuck with
it for a very long time!
Best regards,
Theodore
[1]: https://github.com/kooldev/php-src/pull/2
Hi,
Benjamin Eberlei wrote:
Quoted text · 6 lines
Hello,
I have opened the vote on the Attributes v2 RFC. The voting will be open until two weeks from now, May 4th 2020, noon UTC.
RFC: https://wiki.php.net/rfc/attributes_v2
Thank you everyone for taking part in the detailed discussion.
greetings
Benjamin
Thanks for putting this to a vote. I remember I had some comments about autoloading behaviour and you changed the behaviour in the RFC, but I didn't get around to reading it again. I am concerned though that it doesn't seem to say anymore when autoloading happens, if at all? Can that be clarified?
Thanks,
Andrea
Hello everyone,
i just closed the vote. Attributes v2 was accepted with 51 yay, 1 nay. The selected syntax will be <<Attribute>>.
Thank you everyone for participating in the discussion and vote!
We will start work on merging the patch (quite a few review comments are already addressed). In addition we will probably put up discussion for some adjustments/additions for a follow up RFC over the next few days.
greetings
Benjamin
On Mon, Apr 20, 2020 at 11:18 AM Benjamin Eberlei [email protected] wrote:
Quoted text · 6 lines
Hello,
I have opened the vote on the Attributes v2 RFC. The voting will be open until two weeks from now, May 4th 2020, noon UTC.
RFC: https://wiki.php.net/rfc/attributes_v2
Thank you everyone for taking part in the detailed discussion.
greetings
Benjamin
Quoted text · 13 lines
Hello everyone,
i just closed the vote. Attributes v2 was accepted with 51 yay, 1 nay. The selected syntax will be <<Attribute>>.
Thank you everyone for participating in the discussion and vote!
We will start work on merging the patch (quite a few review comments are already addressed). In addition we will probably put up discussion for some adjustments/additions for a follow up RFC over the next few days.
greetings
BenjaminOn Mon, Apr 20, 2020 at 11:18 AM Benjamin Eberlei [email protected] wrote:
Hello,
I have opened the vote on the Attributes v2 RFC. The voting will be open until two weeks from now, May 4th 2020, noon UTC.
RFC: https://wiki.php.net/rfc/attributes_v2
Thank you everyone for taking part in the detailed discussion.
greetings
Benjamin
Calling it now: This is going to be Drupal 8's "signature feature" the same way property types was for 7.4.
Woohoo!
--Larry Garfield