Re: RFC: Dropping Namespace

From: Date: Wed, 05 Dec 2007 21:26:30 +0000
Subject: Re: RFC: Dropping Namespace
References: 1 2 3 4 5 6 7  Groups: php.internals 
Request: Send a blank email to internals+get-33777@lists.php.net to get a copy of this message
Hi Nate,
Only if you insist on *not* using the namespaces to solve collision problems. For the 1001th time - you can not expect to put all names into global space and have the language by some magic to sort it out and go both ways. One name can mean only one thing, namespaces or not. Namespaces just allow you more convenient rules for defining what name means what thing.
I would like to second this notion. There are those who would say that the global namespace is for the use of PHP itself. I would disagree heartily, PHP as a language is built to serve the developer who is using it. They should decide what exists in the global namespace.
I'm firmly in the 'global namespace is for the use of PHP itself' camp. Why? Because it gives users the choice of totally ignoring namespace support if they don't want to use it, and because allowing user code to define classnames and functions in the global space via import/use (as opposed to by default) has a huge potential for difficult-to-debug misuse. If people want to be able to alias stuff they should be forced to namespace their code.
When I write a library I will often create functions/classes/variables that have no business being used outside my library. So I don't see the need to make the names longer just so I don't collide with someone else's internal variables/classes/functions.
Fine, so namespace it. - Steph

« previous php.internals (#33777) next »