On Thu, Dec 9, 2010 at 11:14 AM, Andrey Hristov <p...@hristov.com> wrote:
> Hi guys, > the topic says most of it. What do you think about deprecating the global > keyword and $GLOBALS with it? Together with this making $_REQUEST, $_GET and > $_POST read-only as they should be used only to read-only anyway. > > The reason for global + GLOBALS is that these are abused and which leads to > spaghetti programs, when used by unexperienced users. Also they have impact > on side effects from functions that don't only rely their parameters. > > Best, > Andrey > > Please next time write an rfc before starting a thread like this. I'm pretty much against the idea. That would be the most dramatic change in the language in the history of php. The register_globals is/was a much bigger problem/bad practice and it take 10 years to remove it(we are almost there...). And to fix the applications, one would either completely restructure all of the functions/methods to pass all of the required data from the global scope, or they would do the easy way: export all of the global variables into a singleton registry. >From a Framework point of view, they should save all of the (super)global variables from the global scope, because the frameworks doesn't use/run code in the global scope except the bootstrap, so they couldn't access that either, but they won't know what the developer who uses the framework want's to access from the global scope. And what about global constants? They are also screwing up the Dependency Injection, and the static functions/properties, and the singletons also. Should we ban those? Tyrael