Re: svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c
| From: | Johannes Schlüter | Date: | Wed, 17 Aug 2011 12:21:57 +0000 |
| Subject: | Re: svn: /php/php-src/ branches/PHP_5_4/Zend/zend_compile.c trunk/Zend/zend_compile.c | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-65882@lists.php.net to get a copy of this message | ||
On Tue, 2011-08-16 at 12:37 -0700, Stas Malyshev wrote:
> Hi!
>
> On 8/16/11 6:19 AM, Johannes Schlüter wrote:
> > It saves one character of typing.
>
> For me, it's the reason enough to prohibit it altogether :) Writing
> weird code to save one character of typing is the worst habit we could
> promote. But I digress since the idea of this patch was obviously not that.
the feature itself is valid. Assume you have
namespace Foo\Bar\Baz\Ba\Do
with a few classes
{
class A {}
class B {}
...
class Z {}
}
then doing a
use Foo\Bar\Baz\Ba\Do;
from a different namespace makes sense, as you don't have to import all
classes from the namespace, which gives a long list but still don't have
to type the full name all the time, instead you can use
new Do\A();
etc. That this works with a single (non nested) namespace name is imo
consistent. Preventing this is an artificial restriction in the syntax.
But the case here in this change is bit more specific (which i
overlooked before). The new error message is only shown in cases where
another error message was shown before ("The use statement with
non-compound name '%s' has no effect") where I consider the old error
message good enough. I'd see the new one as an "easter egg" which I
don't like.
johannes
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
>