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

From: Date: Thu, 06 Nov 2008 03:54:29 +0000
Subject: Re: Call it: allow reserved words in a class or not?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-41704@lists.php.net to get a copy of this message
On Wednesday 05 November 2008 9:24:15 pm Stan Vassilev | FM wrote: > Hi, > > I just wanted a clarification on this. Currently many of us have class > names such as: > > Zend_Validate_Interface > Foo_Utils_Array > > ...and so on. This works fine as it's just a single T_STRING. > > As you know, with the new convention, the parser will not encounter > T_STRING "Zend\Validate\Interface" but rather: > > T_STRING "Zend" > T_NS_SEPARATOR "\" > T_STRING "Validate" > T_NS_SEPARATOR "\" > T_INTERFACE <-- parse error > > I understand it's not trivial to fix this, but I wanted a clarification: is > there a plan to do something about it, or it'll remain an invalid syntax by > the time of release of 5.3. > > Regards, > Stan Vassilev Since I don't see why anyone would want to map the name that directly in the first place, I don't see anything here to fix. In that example, if you imported Zend\Validate\Interface you would then have to use it as: class Bob implements Interface { } Which is of course wrong on many levels. I'd file this under "if it breaks when you do that, don't do that". :-) -- Larry Garfield larry@garfieldtech.com

« previous php.internals (#41704) next »