Hello Internals,

Here is a small comparison table based on current feedback, maybe it
will bring some objective clarity to the discussion:
(markdown below)

Impact|`@@`|`#[]`
---|---|---
BC break|virtualy nonexistent|slightly broader: `##[` comments are now broken.
Parser|no technical problems by now|no technical problems by now
Extendability|less future-proof, arguably|more future-proof, arguably
Grepability|harder, arguably|easier, arguably (however, consider an
Attribute taking an array `[]` parameter.)
Perception|similar to PHPDoc annotations, more familiar to PHP
devs|more familiar to Rust devs

Other issues are either speculative or insignificant (as for me):
- causing future parsing issues: no evidence
- "backfilling": there is, arguably, no use case for it. Code using
PHP 8 features will target PHP 8 anyway. Code, compatible with both
PHP 7 and PHP 8 would most probably use classic PHPDoc annotations.
- "syntax no other language uses": this is probably insignificant.
- "possibility of @@ moving to @ is near to 0": i am not sure anyone
planned to move @@ to @, and if so, it would be an unnecessary BC
break.

I am personally in favor of `@@`, but just because it looks visually
nicer to me. I see no strong objective reason to favor one over the
other. If you want an ending token, maybe consider `@@Attribute@@`,
personally I like those round-ish shapes :P.

On Tue, Jul 28, 2020 at 5:47 PM Joe Ferguson <j...@joeferguson.me> wrote:
>
> Hello Internals,
>
> I've been working with Derick Rethans and others (thanks all!) on a Shorter
> Attribute Syntax Change RFC which outlines reasons why the "#[]" syntax
> would be preferred over the currently agreed upon "@@" syntax for Shorter
> Attribute Syntax.
>
> An important part of the research that went into this proposal demonstrates
> how "@@" will make handling attributes more difficult for PHP_CodeSniffer
> (and similar tools) and shows how the alternative "#[]" syntax is more
> friendly for these tools.
>
> You can find the RFC
> https://wiki.php.net/rfc/shorter_attribute_syntax_change and I'm happy to
> answer any questions as best I can.
>
> --
> - Joe Ferguson
> JoeFerguson.me
> osmihelp.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to