Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90781 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 44060 invoked from network); 21 Jan 2016 14:50:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2016 14:50:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=reeze.xia@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=reeze.xia@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.171 as permitted sender) X-PHP-List-Original-Sender: reeze.xia@gmail.com X-Host-Fingerprint: 209.85.214.171 mail-ob0-f171.google.com Received: from [209.85.214.171] ([209.85.214.171:34070] helo=mail-ob0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CE/57-09073-B10F0A65 for ; Thu, 21 Jan 2016 09:50:03 -0500 Received: by mail-ob0-f171.google.com with SMTP id vt7so36444516obb.1 for ; Thu, 21 Jan 2016 06:50:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=EoV0s3cI92n/ZyZhjoaq6facnXYK5uNOg+k1DUg6q0M=; b=SmuRPOOSaPQsiXgREVgOJvV6Chib3AUXPd75Kx7+TsTNj0cinHw39nJLcedjRYB8Vr YAbID2c4Gii/IQj0dsYBi4XsKNmFb2JmD8SX9HnQbNHp9YFu781G3cVtASkDBSBtm/TC oGxrAemLRHG/jc/MlP8CJX88ju1z5Bmz8HUpwKrZ5Btv8rvhtE6BNExmTemb6p2FRd5Q 8qc6LV7BFUffo1f0wUBS6sACMoX/GvnGgvDEISbI1vwSvi11wdVKXfk8mIca8GUV/6q/ GtfUHElOMxLxV0trGQnQnZLC6nADzGrAON+XnM2dtbGxW7ROphbiWmT8wut21s+VbO1s ii0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-type; bh=EoV0s3cI92n/ZyZhjoaq6facnXYK5uNOg+k1DUg6q0M=; b=A+5iaLoRy1G80X3rYVM4MQ77ogw8f5OySBexGLo0c5VDQCorq5n/xBavXXYMkYpVyL mQpQQpY/GqlmrHe/hkhWoKuB5UrwONsOyVYaeqSvKc6oYnHvhTVcBhoiIuhJjRCDggnY oH0JtJ/tapMpo6J+nkkXx/E3IDW42+UPqpnF86kT1CHF6sTy0F2l8usMF79U0MK8tvpG YcqNalkw2YkMq4pqmcLpQGhtK82zlD4om9piLpm5YM8+44vtsqYEcfPacntEjN1PT6X2 EkkdGzMEZZZ3yPDeTOCtpVVUcW7g77qSsYZ5bFfOCX1VBXzPMjnTGMYpR/ssZqdrnTic d+Lw== X-Gm-Message-State: AG10YORB4qnv6NyefjCqmeVSxvY4Z9hKLzAFqdyGaldCh/ccxQrSpyqrH4szF3UlEAkNy9Ff+21UwjSxZRISwA== X-Received: by 10.60.73.170 with SMTP id m10mr1700846oev.51.1453387800770; Thu, 21 Jan 2016 06:50:00 -0800 (PST) MIME-Version: 1.0 Sender: reeze.xia@gmail.com Received: by 10.202.89.133 with HTTP; Thu, 21 Jan 2016 06:49:41 -0800 (PST) In-Reply-To: References: Date: Thu, 21 Jan 2016 22:49:41 +0800 X-Google-Sender-Auth: Py8cFts6l7y3Lb5nN0ZML33WoJ8 Message-ID: To: Dan Ackroyd Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a1135fd069600530529d93736 Subject: Re: [PHP-DEV] [RFC][DISCUSSION] Allow default value in list() syntax From: reeze@php.net (reeze) --001a1135fd069600530529d93736 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Bump this to continue discussion of this RFC ( https://wiki.php.net/rfc/list_default_value). In case some of you didn't follow it before. This RFC propose to allow set default value in list() assignment=EF=BC=9A list($a =3D 'default value') =3D $arr; On 10 November 2015 at 11:14, reeze wrote: > Hey Dan, > > On 9 November 2015 at 23:24, Dan Ackroyd wrote: > >> Hi Reeze, >> >> On 9 November 2015 at 13:35, reeze wrote: >> > Hi internals! >> > >> > I'd like to open a discussion on the RFC to allow set default values f= or >> > list() assignment: https://wiki.php.net/rfc/list_default_value. >> > >> > What is your idea? >> >> I find the list construct to be quite magic already. Isn't it possible > > to get the affect that you want without adding anything to the core by >> doing this: >> >> $defaults =3D ['default', 'default']; >> $input =3D [1]; >> >> list($a, $b) =3D array_replace($defaults, $input); >> >> I'd find that way easier to understand and explain to junior devs, >> > > I saw the contrast way, it is more complex ;-). This seems like a trick. > Many feature could also be remove, > such as I refered in RFC: Null coalesce "??" and Ternary Operator "?:" > > And the trick is trick. If you want to unpack nested array. > > list($a, list(list($b))) =3D $array > > Then you might need a new trick to do that. > > You know we have default for function declaration: > function func($a=3D'default') {}; and almost all language have the featur= e, > it is easier to understand from my perspective. > > >> compared to having more functionality added to the 'list' magicness. >> >> cheers >> Dan >> > > > > -- > Reeze Xia > http://reeze.cn > --=20 Reeze Xia http://reeze.cn --001a1135fd069600530529d93736--