On Tue, Aug 11, 2020 at 11:25 AM Andreas Leathley <a.leath...@gmx.net>
wrote:

> This would be a feature if libraries start parsing PHP token by token
> and start supporting the #[] syntax for the 7.x versions of PHP - then
> early adoption would be possible and it would be a real feature. But it
> seems unclear if that will happen, as it will probably have a heavy
> price on performance (and might have some complexity). And if some
> libraries implement it but others don't, then it might get confusing for
> users about why the new attribute syntax sometimes works and sometimes
> silently does nothing.
>
>
The perf penalty on 7 and earlier would probably be similar to existing
state of the world.
Parsing a docblock is easier to fetch from the runtime (as we actually
store it), but docblocks contain more than just annotations, so some plus
some minus.
PHP 8+ performance on theses would certainly be between though, and that's
an extra carrot to push users to upgrade.  If annotations can't be written
until after users upgrade, then that carrot vanishes.


> It is also not perfect as multi-line attributes with #[ still break, or
> code with #[] followed by more code instead of a newline and then more
> code.
>
>
That's true. It'll take some care (and possible reduction in readability)
to make annotations work well across verisons, but it's better to have an
option than not, no?
-Sara

Reply via email to