Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82533 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80948 invoked from network); 12 Feb 2015 13:43:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Feb 2015 13:43:29 -0000 Authentication-Results: pb1.pair.com header.from=ivan.enderlin@hoa-project.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ivan.enderlin@hoa-project.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain hoa-project.net designates 212.85.154.38 as permitted sender) X-PHP-List-Original-Sender: ivan.enderlin@hoa-project.net X-Host-Fingerprint: 212.85.154.38 unknown Received: from [212.85.154.38] ([212.85.154.38:45720] helo=mail.hoa-project.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1D/95-50473-EFDACD45 for ; Thu, 12 Feb 2015 08:43:27 -0500 Received: from hywan.local (206.226.4.85.dynamic.wline.res.cust.swisscom.ch [85.4.226.206]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.hoa-project.net (Postfix) with ESMTPSA id 64E0620FC6 for ; Thu, 12 Feb 2015 14:43:23 +0100 (CET) Message-ID: <54DCADFA.6070908@hoa-project.net> Date: Thu, 12 Feb 2015 14:43:22 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: internals@lists.php.net References: <54DC788E.7000000@hoa-project.net> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV][RFC][VOTE] Group Use Declarations From: ivan.enderlin@hoa-project.net ("Ivan Enderlin @ Hoa") On 12/02/15 14:21, Marcio Almada wrote: >> Thanks for the RFC! >> We discussed a little bit with the Hoa [1]'s and fruux [2]'s community > and we have a question. >> Why not pretending we have an array of symbols, something like: >> use Foo\Bar\[Baz, Qux]; >> instead of >> use Foo\Bar\{Baz, Qux}; >> This is a list vs. block debate. While I personally would go for `{` and > `}`, here we declare a list, so we guess the array syntax >> would be more tailored. >> Thoughts? > Hi, Hi :-), > This is an interesting one. During research, the `[` and `]` syntax was > considered for a while but it quickly felt apart for the following reasons: > > 1. Most people considered on PHP the array construct is a very important > building block and therefore we should avoid to multiplex or reuse its > syntax in multiple contexts. This becomes more clear in cases involving > conflict resolutions: > > use Foo\Bar\[Baz *as* Buz, Qux\Quaz *as* Quiz]; +1. > 2. Block syntax seemed more versatile and prone to reuse because we already > have the traits conflict resolution syntax: > > http://php.net/manual/en/language.oop5.traits.php#language.oop5.traits.conflict > > The reasoning for using commas to delimit imported entities and not `;` is > that current use declaration syntax is a comma separated list: > > use function foo\math\sin, foo\math\cos, foo\math\cosh; > > Hence the `{..., ...}` syntax seemed the most tailored to feel similar and > obvious for most of the current PHP userbase, based on all experiments: > > use function foo\math\{ sin, cos, cosh }; > use function Foo\Bar\{ A, B as Baz, C }; > > I hope that the given information is useful to your decision process. Good > voting! Yup sure. We are going to vote yes (behind my nickname). However, while I agree with all your arguments, we have more syntax and more semantics, it's kind of confusing :-/. But it's a small one, so +1 for us. -- Ivan Enderlin Developer of Hoa http://hoa-project.net/ PhD. computer scientist Hacker http://mnt.io/