On Thu, Jun 4, 2020 at 1:55 AM Theodore Brown <theodor...@outlook.com> wrote:
> Hi internals, > > I discussed the syntax for attributes further with Benjamin, Martin, > and several other internals developers off-list, and with their > feedback completed an RFC proposing to use the shorter `@@` syntax > instead of `<<>>` for attributes in PHP 8. > > https://wiki.php.net/rfc/shorter_attribute_syntax > > The goal is not to bikeshed over subjective syntax preferences, > but to address several concrete shortcomings related to verbosity, > nested attributes, confusion with generics and other tokens, and > dissimilarity to other common languages. > Larry's suggestion about #[Attr] makes an important argument about allowing to declare attributes in code in PHP 7 in a forward compatible way that has not been brought up before. /** @ORM\Entity */ #[ORM\Entity] class User {} This code would work on PHP 7 and 8. The #[] syntax would have about equally low breaking potential as @@. It would be the same syntax as Rusts, and close to C++/C# syntax. As such, instead of going through each alternative syntax one by one, with with each having a 2/3 requirement to overthrow the old one, I would be open to restart the secondary vote on Attributes syntax with <<>> (status quo), @@ and #[] using the same ranked voting algorithm that was used for the PHP 8 RM vote. @Sara @Gabriel I suppose this is something you two should be ok with (and Theodore of course). I would take on the work to write about the third syntax alternative then. The VoteRFC could just link to the three individual RFCs where each discusses their syntax. > > Best regards, > Theodore > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >