Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90698 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 93822 invoked from network); 18 Jan 2016 12:56:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Jan 2016 12:56:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.182 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.223.182 mail-io0-f182.google.com Received: from [209.85.223.182] ([209.85.223.182:33503] helo=mail-io0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/3A-20254-4E0EC965 for ; Mon, 18 Jan 2016 07:56:05 -0500 Received: by mail-io0-f182.google.com with SMTP id q21so548540153iod.0 for ; Mon, 18 Jan 2016 04:56:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=hzaHNCKFE/MQ0K82z8P1b06N6vLWTiaYJqnL411CAoU=; b=mj08Bc2im67WaVjmXkVqOCUEwD+z8V5IeRbhl3ExZrUuEEkmwIJhE1oHLdEm1wvSBY z8q1Uql4TGcZx585OVYYoZ0kt4w6vS0enuc6J+0BMS7xfyiL9AszE9hFqzURT2wCwviQ Z4tpzX23pVkxHOyJJCUN6IU+3UPziPaEUlB3/d7BA883I7CcZpi8qe5WFvbnMBEH4f7M eZNlzlPC3oux3UmFCut70dKx2hsdOWngVDvwjDoLvSl23yUe5Q+DPcIwq+fEnAr4v1l0 XpyNS0COhVPUVUpVuiNxK0hQBg6Wy31hhrWd3JUVzOmqpTCFa0/INn7Rnwer7+fF2d0T eVqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=hzaHNCKFE/MQ0K82z8P1b06N6vLWTiaYJqnL411CAoU=; b=hvmQZZNAhpZApvdWJYSouCsnr6/dN6C50fLnbsUzRBXP16PSQvVGR65CmZ+Bs4qo1q zMztfeSx60kAcfL4JGpCiJHlma+rvsXQY/k26jTsB/S5LPYE2LFoENLVAEvojMEhEhR7 lpEalDodxHs2t4NIRYQnxlZotpRJ2foOZT5Nl6nrWzmbyUC7HsR35qp+5BhU2DxLL7dI th44jJ5qojE6NTihhtmtzP20nG4fGGcBJTV/dUOmAdC82HawE6jiUOjMC/UXqgdhruEk FtyyfZT9QW3VNXS9PfnaUUaenrfwB+6JwtSK1J8DkBQ1J/n3aPTGnPfw9CF0Ca46zy/W eXQw== X-Gm-Message-State: ALoCoQkzWuInEwDHV+6GGox5UjW8twcPtoGjk2LBVohfVx0GFvpSpCoBHTElBVqcWVu/NxBIYJaQXrW1W5bENHdVwxuFi9Nryw== MIME-Version: 1.0 X-Received: by 10.107.44.199 with SMTP id s190mr25340925ios.24.1453121762240; Mon, 18 Jan 2016 04:56:02 -0800 (PST) Received: by 10.36.95.210 with HTTP; Mon, 18 Jan 2016 04:56:02 -0800 (PST) In-Reply-To: <569CDC1C.2070304@lsces.co.uk> References: <3B.E6.32157.D3DFA965@pb1.pair.com> <569C91FE.8030605@php.net> <569CDC1C.2070304@lsces.co.uk> Date: Mon, 18 Jan 2016 12:56:02 +0000 Message-ID: To: Lester Caine Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=001a11395ca8742e3705299b466c Subject: Re: [PHP-DEV] [RFC] Allow specifying keys in list() From: leight@gmail.com (Leigh) --001a11395ca8742e3705299b466c Content-Type: text/plain; charset=UTF-8 On 18 January 2016 at 12:35, Lester Caine wrote: > > Hi! > > > > I found the idea convincing from the first read, but maybe it's just my > > mind's assumptions about list() that I dislike the resulting syntax, > > yet, it seems to be the logical choice. > > > > So, maybe I'm just trying to say, that I don't like list() to be reused > > for that, but I don't have any better idea otherwise. > > As someone still using 'extract' in legacy code, I can sort of see the > logistics of this, but why not just extend 'extract' to use the current > object rather than the symbol table. It already has handling for > duplicate keys and to prefix the 'array' name to the resulting variables. The uses for this extended syntax go beyond simply populating object properties, and shoehorning it into extract would pretty much limit it to this use-case. In favour of this improvement, although I would very much like to see variable keys too (second option makes the most sense to me, as it's in line with the syntax). How feasible would it be to add an exception to mixed keys? I'm thinking list(7 => $a, $b, $c, $d) to specify an initial offset, similar to how you can define an array as [7 => 0, 1, 2, 3]. This obviously goes hand in hand with my desire for variable keys :) Thanks Andrea, looking forward to this. --001a11395ca8742e3705299b466c--