Am 21.08.2024 um 09:44 schrieb Faizan Akram Dar <[email protected]>:
> On Wed, Aug 21, 2024, 9:34 AM Christian Schneider <[email protected]> wrote:
>> The point where I think we disagree is that it improves the code. It may improve
>> performance of the code (even though I somewhat doubt this has a *significant* impact on most
>> projects) but it IMHO hurts readability. Writing the additional \ is less of a problem but as code
>> is read a lot more often than written I think the additional "line-noise" is something
>> I'd like to avoid.
>
> You don't have to write additional \,
> you can add "use function" statements
> if you prefer that style.
I think that is trading one problem for another:
- Having to declare all global functions like strlen with 'use' is (IMHO) unnecessary
boilerplate which also needs to be kept in sync with the rest of the code below
- I am generally wary of top declarations changing "semantics" of code further down the
line. Being able to tell what is being done without (far away) context is a feature and that's
why I e.g. prefer foo($GLOBALS['bar']) to global $bar; ... foo($bar).
Regards,
- Chris