Re: [RFC] Shorter Attribute Syntax Change RFC 0.2
| From: | Derick Rethans | Date: | Fri, 07 Aug 2020 11:03:50 +0000 |
| Subject: | Re: [RFC] Shorter Attribute Syntax Change RFC 0.2 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111366@lists.php.net to get a copy of this message | ||
On Fri, 7 Aug 2020, Theodore Brown wrote:
> On Thu, Aug 6, 2020 at 12:30 PM Benas IML <benas.molis.iml@gmail.com> wrote:
>
> > On Thu, Aug 6, 2020, 8:05 PM Theodore Brown <theodorejb@outlook.com> wrote:
> >
> > > While none of our syntax options are perfect, I believe @@ has the
> > > best long-term tradeoffs because:
> > >
> > > - It doesn't break useful syntax
> >
> > Fair enough.
> >
> > > - It is equally or more concise than grouped attributes without
> > > adding complexity to the parser/compiler
> >
> > Are we really going to debate that ~30 lines of code add complexity?
>
> I don't know how many lines of code it will be, since an
> implementation for it has never been finished. The patch currently
> linked in the RFC does not implement it.
>
> Even if we assume the implementation is only about 30 lines, it's
> still extra complexity that I don't understand the benefit of. I
> sincerely would like to know what advantage there is of grouped
> attributes over the
@@ syntax.
It was very *specifically* voted for:
https://wiki.php.net/rfc/attribute_amendments#group_statement_for_attributes1
The complexity is minimal:
https://github.com/php/php-src/pull/5928/commits/597688fd5b0a41d23028454b62ba25f950f35a16
And most of the change is just indentation.
You still haven't addressed any of the deficiencies that the other
alternatives don't have:
https://wiki.php.net/rfc/shorter_attribute_syntax_change#proposal
> I would agree that @[] is more similar than
> #[] is. But arguably
> @@ is still the closest since docblock annotations don't
> require
> being wrapped in array brackets.
They're instead wrapped in /** … */ though, which also acts like a
grouping structure.
> > > - It is aligned with the attribute semantics of the majority of C
> > > family languages
> >
> > In what way #[] or @[]
> > aren't?
>
> The majority of C family languages use @Attr without an extra
> end
> symbol.
PHP isn't C though—hack, C has a function 'creat()', so that argument
doesn't really mean much.
cheers,
Derick
--
PHP 7.4 Release Manager
Host of PHP Internals News: https://phpinternals.news
Like Xdebug? Consider supporting me: https://xdebug.org/support
https://derickrethans.nl | https://xdebug.org | https://dram.io
twitter: @derickr and @xdebug