Re: [RFC] Shorter Attribute Syntax Change RFC 0.2
| From: | Benas IML | Date: | Sat, 08 Aug 2020 08:35:03 +0000 |
| Subject: | Re: [RFC] Shorter Attribute Syntax Change RFC 0.2 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111373@lists.php.net to get a copy of this message | ||
>
>
> This is some new complexity, even if only a small amount right now.
> My question remains about how much more added complexity it will
> require later if we implement extensions like nested attributes.
>
What? Are you actually saying that 30 lines of code add "complexity"? I
think you should look more at the PHP source code before going to these
nonsensical conclusions. PHP is a fully fledged language, not a "let's
write the shortest code possible" competition.
As for the nested attributes, you can implement those with simple
recursion. You are trying to create problems here that don't exist.
> Yes, PHP has historically been rather verbose in some ways.
> Thankfully this has been gradually changing, with the short array
> syntax added in 5.4, and more recently short arrow functions,
> constructor property promotion, and the match expression having an
> explicit goal to reduce verbosity.
>
No offense intended but saying that 1 extra character somehow adds
verbosity is quite honestly, one of the stupidest things I have heard.
While we at it, let's also rename other keywords:
function to f,
while to w and static to s. You know, to save
those few extra
characters.
> What is the goal of the grouped attribute construct? I still haven't
> received an answer about what makes it better than @@.
>
You can't compare attribute syntax against attribute feature. You better
tell me why @@ is better than @[] using arguments and not with "boo,
I
have to type 1 extra character with @[]".
As for the grouped attributes. Why do we allow grouped properties and class
constants? It's alternative code style that some might prefer.
>
> Aren't docblock annotations only wrapped in /** */ because they have to
>
be inside a comment? There is no need for this with the native
> attribute syntax. To me, the #[] and
> @[] tokens don't at all look
> similar to docblock comment boundaries, anyway.
>
Even more so with @@, which look nothing alike to docblocks. Just because
docblock annotations contain the same character as attribute syntax, it
doesn't magically mean "it's like docblocks". Because if so, @[]
looks
far far more like docblocks than @@.
> Best regards,
> Theodore
Best regards,
Benas