
Originally Posted by
Ezku
And you could go and code the whole thing in ASM while you're at it.
Namespaces most certainly wouldn't be a mere tool to better integrate foreign class structures. They could be used to chop the sections of a single project to nice, tight bunches with simple class names as an added bonus. I guess this is what they call packages.
A solution such as proposed by Lazesharp would allow you to be simple and merely use namespaces to prevent clashes - and what a relief would that already be -, but also delve in deeper and devise a neat little package management system customized to accommodate any and all structures you can just come to think of. I honestly can't see why you're opposing this so firmly.
I'm not opposing this. I just haven't seen it as very necessary. It is a optional feature that people who think namespaces are neat will use, but that's about it.
My point is that if either way you have to change your code to avoid namespace clashes. Say you start with this code:
PHP Code:
class File{
function __construct() { echo 'File'; }
}
and you discover that you have a name clash, you can either do:
PHP Code:
namespace foo {
class File{
function __construct() { echo 'foo:File'; }
}
}
$foo = new foo:File();
or you can do:
PHP Code:
class foo_File {
function __construct() { echo 'foo_File'; }
}
$foo = new foo_File();
Bboth require a change, neither protects you more from namespace clashes, and the namespace solution is more verbose. I just can't get excited about using colons instead of underscores. And the reasons given are things like "I haven't heard of Python programmers complaining about it" or "go and code the whole thing in ASM while you're at it" which are not too persuasive.
Bookmarks