Re: multiple use

From: Date: Mon, 02 Jun 2008 06:42:47 +0000
Subject: Re: multiple use
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-38068@lists.php.net to get a copy of this message
Hannes Magnusson wrote:
On Sun, Jun 1, 2008 at 7:43 PM, Stanislav Malyshev <stas@zend.com> wrote:
Hi!
use FooBar::In::Some::NameSpace as foo, SomeOther::Cool:Massive::awesome::space as bar, And::other:namespace as foobar; vs use FooBar::In::Some::NameSpace as foo; use SomeOther::Cool:Massive::awesome::space as bar; use And::other:namespace as foobar;
Well, with (im)proper formatting many things can be unreadable, but
use FooBar::In::Some::NameSpace             as foo,
SomeOther::Cool:Massive::awesome::space as bar,
   And::other:namespace                    as foobar;
doesn't seem unreadable at all to me. Repeating "use" is just clutter which doesn't add anything. And btw not all names are that long - when I actually used namespaces in the code, I found that it'd be much easier if I could chain declarations. Just as it is easier to do $a = array(1,2,3) and not $a = array(); $a[0] = 1; $a[1] = 2; $a[2] = 3;
I don't know what else I can say. You asked if someone had objections and I replied stating my personal opinion that I find explicit use statements in multiple lines more readable. Perhaps it is. But like mentioned earlier, you can do it with multiple things already, it only makes sense adding that support to the use feature also.
I don't really see the point in dropping three characters if you are going to indent it just the same anyway, doesn't even safe you a single keystroke.. I'd say use <tab> more often :->
You don't have to use it, it doesn't exclude the other.
-Hannes
If it's not too much work, and if it doesn't break anything. I'd say just add it, let's not counter every patch that makes it to the list. - Mark

« previous php.internals (#38068) next »