Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:89902 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48854 invoked from network); 27 Dec 2015 23:29:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Dec 2015 23:29:34 -0000 Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 78.32.209.33 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 78.32.209.33 freshmint.phcomp.co.uk Received: from [78.32.209.33] ([78.32.209.33:50619] helo=mint.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 56/CF-51216-D5470865 for ; Sun, 27 Dec 2015 18:29:34 -0500 Received: from addw by mint.phcomp.co.uk with local (Exim 4.72) (envelope-from ) id 1aDKkk-0000Mx-Fu for internals@lists.php.net; Sun, 27 Dec 2015 23:29:30 +0000 Date: Sun, 27 Dec 2015 23:29:30 +0000 To: internals@lists.php.net Message-ID: <20151227232930.GB18189@phcomp.co.uk> Mail-Followup-To: internals@lists.php.net References: <56807248.4060609@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56807248.4060609@gmail.com> Organization: Parliament Hill Computers Ltd User-Agent: Mutt/1.5.20 (2009-12-10) Subject: Re: [PHP-DEV] RFC proposal for alternative list syntax From: addw@phcomp.co.uk (Alain Williams) On Sun, Dec 27, 2015 at 03:20:40PM -0800, Stanislav Malyshev wrote: > Hi! > > > // With the new array syntax this has been improved to > > > > list ($a, $b) = [1, 2]; > > > > // I think this new syntax should logically extend to > > > > [$a, $b] = [1, 2]; > > list() and array() are two different language constructs, using the same > syntax for them is a bad idea. What he wrote looks very perl-ish, but with [] instead of (). The perl ideom to swap the values of 2 variables: ($b, $a) = ($a, $b); could be written in PHP as: [$b, $a] = [$a, $b]; Looked at that way (left hand of '=' only) it is not that bad. -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include