Re: [RFC] [Discussion] Shorter Attribute Syntax Change
| From: | David Rodrigues | Date: | Thu, 30 Jul 2020 14:33:34 +0000 |
| Subject: | Re: [RFC] [Discussion] Shorter Attribute Syntax Change | ||
| References: | 1 2 3 4 5 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-111267@lists.php.net to get a copy of this message | ||
I think that verbosity is not a problem if compared to "strange mixed
symbols", mainly to new users. Google it is a bit hard "what means double
at". And "using attribute" is very clear.
Anyway, I think that is valid we use it for now until we have a good symbol
arrangement, and on future we could have the "verbose syntax" ("using
attribute()") and shortened syntax (to be decided, but like "#[...]").
Atenciosamente,
David Rodrigues
Em qui., 30 de jul. de 2020 às 11:09, tyson andre <tysonandre775@hotmail.com>
escreveu:
> Hi David,
>
> > I would like to suggests the syntax "using attribute(Attribute, ...)". It
> > is more clear and should not create BC.
>
> I'd agree that it's implementable and works with the tokenizer.
>
> My main objection is the verbosity, which is the reason I assume many
> other languages have fairly short/distinct attribute syntax.
>
> ```
> // Assume Unused tells IDEs/analyzers/linters not to warn about unused
> parameters,
> // and Override warns about a method not being an override
>
> using attribute(Override)
> public function apiMethod(
> using attribute(Unused)
> array $params,
> using attribute(Unused)
> bool $featureEnabled,
> using attribute(Unused)
> array $options,
> ) {...}
> ```
>
> - Tyson