On Fri, 3 Jan 2020 at 11:37, Nikita Popov <nikita....@gmail.com> wrote:

> Overall though, I do tend to agree that the use of static methods is at
> this point more idiomatic than the use of free-standing functions, and it
> might make more sense to go in that direction.
>


Perhaps a way forward would be to effectively abandon namespaced functions
as a language feature:

* Implement https://wiki.php.net/rfc/use_global_elements
* Plan to eventually make "use global functions" the default
* Revive the "static class" modifier, which was rejected under
https://wiki.php.net/rfc/abstract_final_class primarily on the grounds that
"namespaced functions should be used instead"
* Add a "use function A::foo" syntax that requires the target function to
actually be static

Namespaces containing only functions and constants could then be replaced
by autoloadable classes.


However, if we're looking at radical changes of direction, I wonder if we
should instead plan to phase out autoloading itself. With OpCache and now
pre-loading, the idea of "only include the files you need" makes much less
sense than it did ten years ago. OpCache on the command-line is probably
used much more rarely, but given how easy it is to incidentally pull in
dozens of classes from a third-party library, maybe that's something that
should change?

Regards,
-- 
Rowan Tommins
[IMSoP]

Reply via email to