Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105145 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 34715 invoked from network); 8 Apr 2019 16:25:21 -0000 Received: from unknown (HELO mail-it1-f173.google.com) (209.85.166.173) by pb1.pair.com with SMTP; 8 Apr 2019 16:25:21 -0000 Received: by mail-it1-f173.google.com with SMTP id k64so20849283itb.5 for ; Mon, 08 Apr 2019 06:21:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8sZPWlxhD3G9Qn7VI12ikNTaYQQbroK8OqSPf/STMAs=; b=i2EoEzUoBpr7vVHEqTNzVNDuxQ/GtDnyJ+UFt0aLKGaZiWw+01yxBRqRlMhnRFaTir V5R7ccyCWRRoV9HXqiJ+XUNEGoAlqTtrRXvBtREoJhW3UyLsqUKr8GA8AkEA6eoW4o9m zPGx65HR/3CdDvDIC7IgHMlvkTn3UNbrqeueC/IKNjqTY4kLmiHjMeYWq885AqWKY6qx 7KyMjIcjB147WoiSSx8yBJepB8IOyfix9L+yU9qRGGFqq1Eq68Tl11iwTxYekk/+mr4r UBUZz11bhO16ccEvzVEveh/WskUO+yphTHSsJn3AEJR2Gx+BA0wk5UpSszjlTgNY3uzt xbuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8sZPWlxhD3G9Qn7VI12ikNTaYQQbroK8OqSPf/STMAs=; b=F2nvB3GeOPntPbBb4/PqDssJHJzGNzYFg3u+IaFE5reaHFKD+toa0cLnh9HO2OurrB l/ANEW4urDUnlhNIW5N4R+rB39pSLIQlwfLhfJaaqCoWQbtv+7wHn4nKm1VS6lYl5oEL SuKE+RLNZcUY4EkDIvZfHS8mqj/h/jw5vaMSCRqAIkA2z6xX1GZ7CRATTwImso8wyThm fYgTtw2PrmF5xpSq90ClnwEbmJK2Yeca6Md9m5A8BICF57u+8uEzaoyPawsth9Jl613N qnqeKQB2MS1YflE8K5TFeORPGpnWIl07qPd1vlkLA8v13zkxinW8h+Ye3uZe6f8FL2S5 5GAg== X-Gm-Message-State: APjAAAV6iFV515Z0BzneR/kfxiv1nO+7nuywS8zxvtIYgTL6xTuVhBT5 PhnLrqbsrHHoqY7dM79h98fsb4f+Y2InIlJpY9qJ/smWtj8= X-Google-Smtp-Source: APXvYqxwKWYykBH5BmTRECiptJIlomqouiHgW7CfLxWa0eGQ4Np8GdASyxCBSWC3AmH9JOGlPHex3p+1pho07+O8/uY= X-Received: by 2002:a24:3945:: with SMTP id l66mr13289799ita.125.1554729719512; Mon, 08 Apr 2019 06:21:59 -0700 (PDT) MIME-Version: 1.0 References: <003a01d4eaf0$c17d6c20$44784460$@jhdxr.com> In-Reply-To: <003a01d4eaf0$c17d6c20$44784460$@jhdxr.com> Date: Mon, 8 Apr 2019 15:21:41 +0200 Message-ID: To: CHU Zhaowei Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000a76613058604b88c" Subject: Re: [PHP-DEV] [RFC] Spread Operator in Array Expression v0.2 From: nikita.ppv@gmail.com (Nikita Popov) --000000000000a76613058604b88c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 4, 2019 at 4:15 PM CHU Zhaowei wrote: > Hi internals, > > Thanks for the people who joined the discussion of my [RFC: Spread > Operator in Array Expression]( > https://wiki.php.net/rfc/spread_operator_for_array). The biggest change > is I have dropped the support for string keys in v0.2 as suggested by C= =C3=B4me, > to make the behavior of spread operator consistent. I have also added Q&A > to explain the questions I received. > This looks reasonable to me. My only concern would be the "by-reference passing" section of the RFC. The current proposal states that [...$arr] will preserve references in $arr, which is not the behavior I would expect. Is this choice for parity with the unpacking functionality in calls? In that case I think it is important to understand that for argument unpacking the handling of references is decided by the called function, not what is in the array. If the function accepts an argument by-reference, then the corresponding element in the array will be turned into a reference (regardless of whether it was one before). Conversely, if the function accepts an argument by-value, then the element from the array will be passed by-value (regardless of whether it was a reference before). A similar concept doesn't really exist for unpacking in arrays. Regards, Nikita --000000000000a76613058604b88c--