Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80721 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39407 invoked from network); 18 Jan 2015 03:01:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jan 2015 03:01:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.207 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.207 imap2-2.ox.privateemail.com Received: from [192.64.116.207] ([192.64.116.207:41459] helo=imap2-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D2/B3-18613-EE12BB45 for ; Sat, 17 Jan 2015 22:01:03 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 07A108C007D; Sat, 17 Jan 2015 22:01:00 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ttPxwUYjWwW2; Sat, 17 Jan 2015 22:00:59 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 884978C0069; Sat, 17 Jan 2015 22:00:56 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) In-Reply-To: Date: Sun, 18 Jan 2015 03:00:53 +0000 Cc: Yasuo Ohgaki , Patrick Schaaf , Simon J Welsh , internals , Marc Bennewitz Content-Transfer-Encoding: quoted-printable Message-ID: References: <52243BA6.5040905@sugarcrm.com> <54B6C047.3070301@mabe.berlin> <48223964-2F90-4386-BD8F-934791E45EB4@welsh.co.nz> <9F083B4E-B603-4A1D-9F1D-C758D835B450@ajf.me> To: marcio3w@gmail.com X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Skipping parameters take 2 From: ajf@ajf.me (Andrea Faulds) Hey Marcio, > On 18 Jan 2015, at 02:22, Marcio Almada wrote: >=20 > Andrea, >=20 >> For consistency with list(), we could also just put nothing: >>=20 >> foo($bar, , $baz); >>=20 >> Which is like: >>=20 >> list($bar, , $baz) =3D $arr; >>=20 >> Thoughts? >=20 > Not sure. Do we consider both contexts (list assignment skipping and > parameter skipping) as assignments? If so, then the consistency > arguments seems very strong to me. Not really. But, list() is very function-like in syntax, so it=E2=80=99d = make sense to follow its lead for actual functions. > Only point against the consistency path is that in the context of > list() the blank identifier is used to discard a value, while on > parameter skipping the blank identifier inherits a previously declared > value. Yes, I suppose that=E2=80=99s a fair point. Though if you were to implement a list() clone as a function (purely for = the sake of example, you wouldn=E2=80=99t *actually* want to do this), = you might actually do something similar: function listLike(&$a =3D 0, &$b =3D 0, &$c =3D 0, array $arr) { if ($a !=3D=3D 0) { $a =3D $arr[0]; } if ($b !=3D=3D 0) { $b =3D $arr[1]; } if ($c !=3D=3D 0) { $c =3D $arr[2]; } } listLike($bar, 0, $baz, $arr); list()=E2=80=99s value skipping is a little bit like function argument = skipping, in that way, right? With this list()-like default value syntax, it=E2=80=99d even work the = same: listLike($bar, , $baz, $arr); =E2=80=A6that probably made no sense. But I think there=E2=80=99s a case = to be made that since list() follows this syntax, we should for function = calls to. By the way, while I was opposed to this RFC before, I am seeing its = value somewhat when using badly-designed APIs like json_decode. That = said, I=E2=80=99m still not sure I like the RFC concept=E2=80=A6 better = to make new, improved APIs than add kludges to make bad APIs more = usable. -- Andrea Faulds http://ajf.me/