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

From: Date: Thu, 06 Nov 2008 10:03:46 +0000
Subject: Re: Call it: allow reserved words in a class or not?
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-41709@lists.php.net to get a copy of this message
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. Dan On Thu, Nov 6, 2008 at 9:50 AM, troels knak-nielsen <troelskn@gmail.com>wrote: > On Thu, Nov 6, 2008 at 10:35 AM, Dan <iammrdan@googlemail.com> wrote: > > What if you want to provide a set of helper/wrapper classes, > appropriately > > namespaced, something along the lines of: > > MyFramework\Helpers\Array > > MyFramework\Helpers\Database > > MyFramework\Helpers\Session > > etc. > > > > If I want to use that naming convention, I don't want to have to name > some > > of my classes differently just because PHP can't deal with it. It may not > be > > trivial to fix, but to the end-developer, it's a trivial problem and it's > > something that should just work. > > I think the point is the same as with Zend_Validate_Interface ; While > MyFramework\Helpers is a fair namespace, Array is a bad classname. You > should use something like MyFramework\Helpers\ArrayHelper > > FWIW Zend_Validate_Interface looks odd to me today already, for that > reason exactly. I read two namespaces and a classname, and that > classname doesn't make much sense. > > -- > troels >

« previous php.internals (#41709) next »