Re: Call it: allow reserved words in a class or not?

From: Date: Thu, 06 Nov 2008 10:12:52 +0000
Subject: Re: Call it: allow reserved words in a class or not?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-41710@lists.php.net to get a copy of this message
Hi Dan, Am 06.11.2008 um 11:03 schrieb Dan:
Isn't the ability to do that one of the biggest reasons for having namespaces? To avoid having to fill your class names with junk. The examples are namespaced appropriately, they tell the developer that it's a Helper for Arrays in the MyFramework framework. I shouldn't need to suffix the class name with 'Helper' to reconfirm that, just because the PHP engine doesn't like it.
we also had lots of classes like "F3\MVC\Controller\Interface", "F3\MVC\Controller\Default" etc. ("default" is also a reserved word unfortunately). So we had to rename all these classes and interfaces. After doing that though, I think it's much better this way. IMO a class name should speak for itself even without namespaces, the namespaces should only put into a certain context: "DefaultController" is a default controller. "F3\FooPackage\Controller\DefaultController" is the default controller of the FooPackage, "F3\BarPackage\Controller\DefaultController" is the default controller of the BarPackage etc. So, even though I was annoyed having to refactor so much code, I am now happy with the results. Cheers, robert

« previous php.internals (#41710) next »