This can definitely be an issue and it was when Guzzle released a new major version every month.
Also when working with projects that are 10+ years and lines of codes a million you will run into this. Sure you can always fork and move the library to another namespace, but that is extra work.
Modules are vastly superior to namespaces, with modules it is the caller that decides the symbol, with namespaces it is the callee.
Another problem with namespaces in PHP is that you can’t put anything into it, like a variable, it is not like namespace in C++. Namespace in PHP is just name added to the class or function name, kind of fake. Don’t get me wrong, it was a pragmatic solution to a real problem and it worked for what it tried to solve, make it easier to share code.
Modules could be elegantly solved in PHP by reusing the internal concept for a class (how it is with enums and interfaces)
Modules would also make it easier to unit test code, because you will not need to worry about a symbol already have been loaded and can’t get unloaded.
With that said I don’t think it the most important feature to focus on, there are others that give more bang for the buck, like string templating and operator overloading.
Yes, because functions can’t be autoloaded and you can’t put variables and constants inside a namespace. But it isn’t hilarious, it is because of legacy.
Now there are proposals to fix function autoloading but it won’t fix variables and constants.
Also when working with projects that are 10+ years and lines of codes a million you will run into this. Sure you can always fork and move the library to another namespace, but that is extra work.
Modules are vastly superior to namespaces, with modules it is the caller that decides the symbol, with namespaces it is the callee.
Another problem with namespaces in PHP is that you can’t put anything into it, like a variable, it is not like namespace in C++. Namespace in PHP is just name added to the class or function name, kind of fake. Don’t get me wrong, it was a pragmatic solution to a real problem and it worked for what it tried to solve, make it easier to share code.
Modules could be elegantly solved in PHP by reusing the internal concept for a class (how it is with enums and interfaces)
Modules would also make it easier to unit test code, because you will not need to worry about a symbol already have been loaded and can’t get unloaded.
With that said I don’t think it the most important feature to focus on, there are others that give more bang for the buck, like string templating and operator overloading.