Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:102332 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95397 invoked from network); 20 Jun 2018 17:02:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2018 17:02:54 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.43 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.43 mail-wm0-f43.google.com Received: from [74.125.82.43] ([74.125.82.43:35823] helo=mail-wm0-f43.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7E/D7-32156-CB88A2B5 for ; Wed, 20 Jun 2018 13:02:54 -0400 Received: by mail-wm0-f43.google.com with SMTP id j15-v6so829955wme.0 for ; Wed, 20 Jun 2018 10:02:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BrHW9XsIDRhDUhx4h9G2s8VJYmlKy0jdMUyHfbG3e3A=; b=gqEPbUmhrJWl9anR+mrOzNnIhWiL19pWSop2rVdM8dQdBzzzKUb79JAM4xIWpNam5U IXwF1vsrVIzhnms5N5uHJ165rKEfQJO4xI8zm9a8zv+uMWq3116Bs1dt6KzZkcOtbFJR lURQc2asqiLWcjPMmkcJ4RiSEGDi9YcLPLGeMVmQq7pXwgLxo0lPRGYiJNX+0FKeXEhV LhRq2arZ28WKhu8QfykJw9P8GSA8DaUcBE2U4EV15BZZkEZp8pQt9FM29mcwi53AmYjF zAKZzhVDGMejyTfWGl8AfMknPedV0skk52TDwC+MdMMOLX5cqFLnnQ8enC+521qDzq5s De5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BrHW9XsIDRhDUhx4h9G2s8VJYmlKy0jdMUyHfbG3e3A=; b=jZcyRs9AopBOE4GwiNyLVLNhb0MJXvIY9RvT9tG3AMrS3dfc/d8x/pgua7Z/SdJIMI kfsQBKXCxXl2zVababVxuLYsRk99AL+ZDGNl5YZrVUjOX63ZegndC2uli4CMV3DK1/IN 7dz+rHrYR8yljg+EtGSiKsdz5dQAA49w4Y4ic/z3ACZ+Xh3QHxWufRg4LQ9N9DL8stut fp7fuhloL3T1l2YKUjzRKAP7E4cXOlnKy3J2CO71acV4Ks8hnhBm0ditCa3OrfAC4e0P MXIBYlvHGj5HN32ecg1udP7FxiDqhpnC9wUcAS6ZNEUic5XkGGxLM8XLyWuhWncPC40Q XEWw== X-Gm-Message-State: APt69E01tkjeF3MMaOXcuviGbhvBZ223akDi8ATGgsVLwrYmWhjO80YW 16RZH28sQR+6A8Sk4mByRU3d7JNefC6hg1JeB7U= X-Google-Smtp-Source: ADUXVKLU0Uf9U8wrXvzxjHgqR+IAyba2ma9h0SxS8uQt15yn51MwTGl9ratT0Q9JsQ6MOGv3hJJM1nSx2APqzna2Ik8= X-Received: by 2002:a50:9a21:: with SMTP id o30-v6mr19012083edb.236.1529514169934; Wed, 20 Jun 2018 10:02:49 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a50:8d55:0:0:0:0:0 with HTTP; Wed, 20 Jun 2018 10:02:49 -0700 (PDT) In-Reply-To: References: <75db877c-ef0b-7d3b-48a8-9879d90352b0@web.de> <76e4744f-6722-ee49-0325-e4433236f1b1@web.de> <73ac8914-8c9f-e74b-a4f5-f6e39cd96f8f@gmx.de> <3242366.BL9MUqXe46@vulcan> <154ba124-2915-ca36-fa39-5df6726d3b5a@web.de> Date: Wed, 20 Jun 2018 18:02:49 +0100 Message-ID: To: Levi Morrison Cc: enno.woortmann@web.de, internals Content-Type: multipart/alternative; boundary="000000000000c7274f056f15c457" Subject: Re: [PHP-DEV] [RFC][Under Discussion] Add functions array_key_first()and array_key_last() From: rowan.collins@gmail.com (Rowan Collins) --000000000000c7274f056f15c457 Content-Type: text/plain; charset="UTF-8" On 20 June 2018 at 17:19, Levi Morrison wrote: > Bad behavior of existing functions does not mean we should create new > functions with the same bad behavior. If you believe lack of education > regarding array destructuring is an issue then we can use this example > specifically in the docs for these functions; problem solved. > I'm torn between your point of view and Enno's. Note that we're not talking about "lack of education regarding array destructuring", because there's no array being destructured; we're talking about "lack of education regarding the side-effect behaviour of the array destructuring operator when given a non-array input". It's a pretty obscure, seemingly undocumented, language feature, and one which the RFC you linked seems to have originally classed as unwanted behaviour. If it was used in a prominent example, maybe other uses for this idiom might start cropping up, and people would start using it. Even so, if I saw it while reviewing or debugging code, I would probably be tempted to refactor it to something "less clever" so that the intent was clearer. On balance, I don't think the example you gave is a compelling reason, on its own, to go with your suggested signature. The separate functions feel more convenient in a lot of cases, but maybe less so in others. Regards, -- Rowan Collins [IMSoP] --000000000000c7274f056f15c457--