On Fri, Aug 23, 2024 at 5:49 PM Rowan Tommins [IMSoP]
<imsop....@rwec.co.uk> wrote:
>
> Other proposals aim to shift that balance - leaving some inconsistency, but 
> less compatibility break.
>
> And most users don't object to using a leading backslash, they just (quite 
> reasonably) have no idea what impact it has on the ability of the engine to 
> optimise their code.

For some context: Before proposing this change, I asked Symfony if
they were interested in disambiguating calls to improve performance,
given I did some work to make fully qualified calls faster. But they
were not, stating that the change would be too verbose for their
liking.

Making unqualified calls to mean local would force Symfony into making
the change, which is not the approach I'm interested in taking. Making
them global would likely reduce breakage by much, but not nearly as
much as keeping the fallback.

>From reading the responses, it seems we have three primary camps:

1. People who don't think BC is a problem, and would like to drop
either the global or local lookup entirely, requiring disambiguation.
2. People who do think BC is a problem, and would like some opt-in
mechanism to explicitly pick global or local scope.
3. People who aren't convinced that the performance improvements are
worth it to begin with, or that the developers themselves are
responsible for disambiguation.

IMO, 1. is too drastic. As people have mentioned, there are tools to
automate disambiguation. But unless we gain some other benefit from
dropping the lookup entirely, why do it? Consistency with class
lookups is a factor, but is it enough to break a large portion of
codebases? The summed up time of every maintainer installing and
running a tool that modifies a large portion of the codebase, and then
dealing with conflicts in existing branches is not miniscule. Fixing
local calls will also require context from other files to correctly
disambiguate. I'm not aware if any tools actually consider context, or
just take the naive approach of making known, internal calls global,
and leaving the rest.

2. misses the point of the immediate performance gains without
modifications to the codebase. Even if the disambiguation itself is a
one-liner, it still needs to be added to every codebase and every
file, and still requires fixing actual local calls that may be made
within the same file.

I obviously also disagree with 3. as I wouldn't have sent this
proposal otherwise. :) Performance improvements are hard to come by
nowadays. It was measured on real codebases (Symfony and Laravel).

Ilija

Reply via email to