Hey, > On 13 Feb 2015, at 16:24, Nikita Popov <nikita....@gmail.com> wrote: > > I'm in favor of this RFC. Honestly I don't really understand the negativity > it is getting around here. > > The ability to import multiple items from one namespace is a > well-established feature you'll find in many languages employing some kind > of namespacing. I don't think the availability of what I lovingly call "IDE > vomit" is a good reason to decline a feature - a programming language > should be able stand on its own and not require IDE assistance for > reasonable use. > > The syntax seems pretty obvious as well - but maybe I just had too much > exposure to Rust, which makes extensive use of the same syntax.
My thoughts echo Nikita’s. I think this feature would be especially important if PHP gets function autoloading (which it may yet gain in PHP 7 - a certain someone has been working on it). Currently, sets of independent functions have to be implemented as static classes. But with function autoloading, they’d have to be imported independently, and that would lead to way too many use statements. This feature is familiar to people who have used other languages, as Nikita mentioned. In Python, I might do this: from somelibrary.math import sin, cos, tan, degrees, radians Simple, uncumbersome, readable. The equivalent in PHP is this: use function SomeLibrary\Math\sin; use function SomeLibrary\Math\cos; use function SomeLibrary\Math\tan; use function SomeLibrary\Math\degrees; use function SomeLibrary\Math\radius; Ouch. Not fun to type, not fun to read, takes up way more space than it should. This is just a modest five functions, too - in many cases you’d be importing more. But with Marcio’s proposal, we could instead write this: use function SomeLibrary\Math\{sin, cos, tan, degrees, radius}; Much better, no? I know which one I’d rather read and write. It’d be a real shame if this doesn’t pass. -- Andrea Faulds http://ajf.me/ -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php