Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96674 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24048 invoked from network); 31 Oct 2016 16:16:07 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Oct 2016 16:16:07 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.17.21 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.17.21 mout.gmx.net Received: from [212.227.17.21] ([212.227.17.21:60477] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 06/DE-25911-44E67185 for ; Mon, 31 Oct 2016 11:16:06 -0500 Received: from [192.168.2.103] ([79.243.119.150]) by mail.gmx.com (mrgmx103) with ESMTPSA (Nemesis) id 0MEFqW-1c7oqH2MvY-00FWK1; Mon, 31 Oct 2016 17:16:01 +0100 To: Rowan Collins , internals@lists.php.net References: <44244cfd-c8ad-e0a9-4e70-380a8a8c940c@syberisle.net> <01f2f3da-592b-fd23-709d-ad620422f56d@fleshgrinder.com> <7fb9a5d5-318d-7ed3-59eb-d9845ed5dec1@gmail.com> Message-ID: <18edb4cc-102c-1866-df66-6cf5d3f0d835@gmx.de> Date: Mon, 31 Oct 2016 17:16:08 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <7fb9a5d5-318d-7ed3-59eb-d9845ed5dec1@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:gnB7iyn5Fhn+ui6CepoHat11HmrkAaetWgKsfnPsYCa/QEOIVGq TALdJIzGy9KKfldPw/TM9eCYNm4H7pl0weWYw5XkRUz+t7CCogj8eUlAvYw8M7VCOxsdbsQ lgghBjOhi3qOwyS3d8Zk98eybkkE+kE5E5im7UTlpDEbxBJ97CmjkuVg0mMIeA+DMWw/K/J d0RhO3/i+7aPjbyq7V3fg== X-UI-Out-Filterresults: notjunk:1;V01:K0:KpdLW0QItKg=:aBvQVSMWP02UERFZcmWelu w/iKEgnENo7u0ZbMiACIHUX1zz/27lcs9e6gJrpRycOlocr/6IH3PujPVzYZlWl+jxWKdhTvd 9QXc3iplKQXWnWMh3d3ZvJe0FrQWRmQi2M3rJAvrRcPBXyw335xMmaF9wSS9E8EITpT2wy26D HwwnD7QZLpdajDBI+cR8bSUQZmsnqfMqZ9dbqzCpMlnoYgVF+HsUg9G8aTrtHIVmems1cdN3F YVIq3HqhmTM8LUsziwWNdEJs9ED61CyQhKaXyoQbHJ9v16Tjpr1ase7qRvHq1ZLVLnShtyIvr nP/VB9PHg6BvbXZHrkyGw0X5Xl957mAqYjS4i5VlK68FYsBqvmgg/Zi1FZZZ6loGgMA2KqnKm O87Qc0N2WOaFPAF90DWsYZ+lkhX/T4ITUlt8Zp0e3QaN5FZtK/M3e9lpHMHrI7tU5FV91rPw+ qdZzWTJXazOf1gJGKflkbdKVCTDU6ZeqTJfHiU83IeJ8CHvb6hABDkhP2PofCyOGT2yuNio6S dnlRiCFob+p7hQdWsNbQvEWQE+OPscqRtXLmJOIikfZdwx8RbRhQrjblGj1bfMHGwRdxeojLO tCxmnCS2gw2y8bcD5UMrvJItg8sZJcNkH9N0fYDkzy1V7MP+7PLl7WwVY6aYhEpLQB3RevRlU h3RrprllIVrp5D7lKetvkFA72npZMxc9a+R+RnT0BljUl5wD+mzrK4mmA6YKPfnsaJVxEPV/W zxU3LuFzl8O84JrcLFzffW5Lwo4hnpp3ijKObC4fr3VNKGRNnh/puIs9DYz7Nujbt9p/jEaoB vdINN+E Subject: Re: [PHP-DEV] Allow Iterator to be used with current, next, reset,key functions From: cmbecker69@gmx.de ("Christoph M. Becker") On 30.10.2016 at 18:19, Rowan Collins wrote: > On 30/10/2016 12:07, Fleshgrinder wrote: > >> I think it makes much more sense to deprecate all of them and introduce >> new ones that work in the way we want them to for several reasons. >> `end()` and `reset()` would have to continue working as they do until >> the next major release since people who use them might rely on the way >> they work. This means in effect that nobody can make her PHP 7 code PHP >> 8 ready up front. >> >> Instead we could directly introduce `array_first()` and `array_last()` >> with the next feature release -- even if the others are not deprecated >> -- and everyone can update their code or at least use it in new code. > > I've always felt like these functions were "missing" from the language - > there are a number of ways you *can* get the first or last item in an > array, but all have side effects, because they're not designed for this > purpose. It just so happens that - most of the time - reset() and end() > have the smallest side effects. > > I can't remember if it was an earlier discussion here, or somewhere > else, that pointed to getting the first and last *key* as an extra use > case worth considering. It's currently possible (if awkward) with key(). > > I think it would make sense to, in the same version: > > - deprecate reset(), end(), each(), and key() > - introduce array_first(), array_last(), array_first_key() and > array_last_key() > - document replacements for whatever other use cases we can find > examples of > > Doing them all at once makes the messaging much clearer - this family of > functions is going to be removed; and here are the new functions you can > start using immediately instead. I fully agree. -- Christoph M. Becker