Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82635 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71595 invoked from network); 13 Feb 2015 18:09:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Feb 2015 18:09:25 -0000 Authentication-Results: pb1.pair.com header.from=pierre.php@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=pierre.php@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.51 as permitted sender) X-PHP-List-Original-Sender: pierre.php@gmail.com X-Host-Fingerprint: 209.85.216.51 mail-qa0-f51.google.com Received: from [209.85.216.51] ([209.85.216.51:35877] helo=mail-qa0-f51.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8B/76-40724-3DD3ED45 for ; Fri, 13 Feb 2015 13:09:25 -0500 Received: by mail-qa0-f51.google.com with SMTP id i13so13560417qae.10 for ; Fri, 13 Feb 2015 10:09:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=BmMrKL4KSzN6mkMwA+c5j9FqHYFaiiukAGdyKg5nhK0=; b=NefXlWJjslaaSsLjqozt9TnMPfLn/NZD46JuZ9X5xStp/9X1C/B4wl1Wd/THInZiuj ZKG2objQtarDcvarWmHfNsqO9pqjHzlwqL1qzJOiFEnjhJudUY2XGZ1c0cXgCTNGnGtf hiDvSwf/mCJaBClm6x09W1RIyvxNTdXrUOJNliprKIZlTNU4uHeAC20FyL63O11Lc8+1 UXd9LMFizhzlA0MW2t2v9j256wBJ6nHChslOX2St//6k1FcIK1UeKCPFXpTDzbvmWpmO mgj/JAhhdFNm1DOQbSmeeeAvJUSEfZS7hBC/eEdpqQBOP0hcET2hlyf7/DT3J/bsZjKG 2DmQ== MIME-Version: 1.0 X-Received: by 10.140.133.21 with SMTP id 21mr4006836qhf.40.1423850961431; Fri, 13 Feb 2015 10:09:21 -0800 (PST) Received: by 10.96.185.37 with HTTP; Fri, 13 Feb 2015 10:09:21 -0800 (PST) Received: by 10.96.185.37 with HTTP; Fri, 13 Feb 2015 10:09:21 -0800 (PST) In-Reply-To: <5EF29B6C-D35B-47B8-8008-47B207B2840B@ajf.me> References: <5EF29B6C-D35B-47B8-8008-47B207B2840B@ajf.me> Date: Sat, 14 Feb 2015 01:09:21 +0700 Message-ID: To: Andrea Faulds Cc: Nikita Popov , PHP internals , marcio3w@gmail.com Content-Type: multipart/alternative; boundary=001a11352982c4f62c050efc226e Subject: Re: [PHP-DEV][RFC][VOTE] Group Use Declarations From: pierre.php@gmail.com (Pierre Joye) --001a11352982c4f62c050efc226e Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Feb 13, 2015 8:41 AM, "Andrea Faulds" wrote: > > Hey, > > > On 13 Feb 2015, at 16:24, Nikita Popov 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=E2=80=99s. > > 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=E2=80=99= 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=E2=80= =99d be importing more. > > But with Marcio=E2=80=99s proposal, we could instead write this: > > use function SomeLibrary\Math\{sin, cos, tan, degrees, radius}; > > Much better, no? I know which one I=E2=80=99d rather read and write. > > It=E2=80=99d be a real shame if this doesn=E2=80=99t pass. Fully agree here, with every said by Nikita and Andrea. I feel again a gap between ppl using php, writing a lot of this code and us. This is worrisome. Cheers, Pierre --001a11352982c4f62c050efc226e--