Re: [RFC][VOTE] Group Use Declarations

From: Date: Sat, 14 Feb 2015 18:03:23 +0000
Subject: Re: [RFC][VOTE] Group Use Declarations
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
> 2015-02-13 13:50 GMT-03:00 Nikita Popov <[email protected]>:
>> use PhpParser\NodeVisitorAbstract;
>> use PhpParser\Error;
>> use PhpParser\Node;
>> use PhpParser\Node\Name;
>> use PhpParser\Node\Name\FullyQualified;
>> use PhpParser\Node\Stmt\Namespace_;
>> use PhpParser\Node\Stmt\Use_;
>> use PhpParser\Node\Stmt\Class_;
>> use PhpParser\Node\Stmt\Interface_;
>> use PhpParser\Node\Stmt\Trait_;
>> use PhpParser\Node\Stmt\Function_;
>> use PhpParser\Node\Stmt\Const_;
>> use PhpParser\Node\Stmt\Catch_;
>> use PhpParser\Node\Stmt\TraitUse;
>> use PhpParser\Node\Stmt\TraitUseAdaptation\Precedence;
>> use PhpParser\Node\Expr\StaticCall;
>> use PhpParser\Node\Expr\StaticPropertyFetch;
>> use PhpParser\Node\Expr\ClassConstFetch;
>> use PhpParser\Node\Expr\New_;
>> use PhpParser\Node\Expr\Instanceof_;
>> use PhpParser\Node\Expr\FuncCall;
>> use PhpParser\Node\Expr\ConstFetch;
>>
>> Damn, this looks unwieldy. With this proposal it becomes:
>>
>> use PhpParser\{NodeVisitorAbstract, Error, Node};
>> use PhpParser\Node\{Name, Name\FullyQualified};
>> use PhpParser\Node\Stmt\{
>>     Namespace_, Use_, Class_, Interface_, Trait_, Function_,
>>     Const_, Catch_, TraitUse, TraitUseAdaptation\Precedence};
>> use PhpParser\Node\Expr\{
>>     StaticCall, StaticPropertyFetch, ClassConstFetch, New_,
>>     Instanceof_, FuncCall, ConstFetch};
>>

It's only the former (existing) format which has benefits at all to me:

- cognitively *I* can much easier glance through to "find" something.
Because my eyes just have to scan up/down on the same character column

- It's not alphabetically sorted (which just is important to "find"
things for a human, IMHO). No problem! Good text editors allow to sort a
selected text area alphabetically. Good look trying that with the group
syntax; this requires manual labor work or tooling.

- Markus


Thread (45 messages)

« previous php.internals (#82694) next »