Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:96638 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 65354 invoked from network); 29 Oct 2016 20:06:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Oct 2016 20:06:52 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.41 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 74.125.82.41 mail-wm0-f41.google.com Received: from [74.125.82.41] ([74.125.82.41:37370] helo=mail-wm0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0F/CA-25911-A5105185 for ; Sat, 29 Oct 2016 16:06:50 -0400 Received: by mail-wm0-f41.google.com with SMTP id 140so123998780wmv.0 for ; Sat, 29 Oct 2016 13:06:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=GpOlBF3tChsMHHe41dt5i59nm78/3gZfUUMPWsWBSUg=; b=ce4c+2sRMe8kUdsRwT5rbVy03f0/ObMpRuKveP5vacxfE5mM43o54mJRxqPwWwOylf aeSDwllYOiDR6WRtT40nlSjbs9YAcv1f5KXE9e3jQYy4bhKE+S58BxGRRHBQJWqRWLEZ 0J8X+CPqu9QKJDtmJcF2ITNgcgXKQwLuHtSvvlja7pFw7pXxYMBdPWHZu3qftuCjeuDY TdM2w1esXwEw//9llWxZJvvVFiw27gFxr0ZAyLR8S8XCBmVzkhb0Rnpbc6ViJ6PHgs+O BsOaXECIfJMqMmUOx4w4X2byBeI0rv41U0QWjO9OYRCxvrUMTKr69uMKNXLtQdV4cBiq j7wg== 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:from:date :message-id:subject:to:cc; bh=GpOlBF3tChsMHHe41dt5i59nm78/3gZfUUMPWsWBSUg=; b=VM1BzF6W2UMDGXZ4H0ttVp31jWLlREXYtcdk9MfMrA4K34UZ2IhIyZb9WF+4XdCrvZ FMu5gtEjXOFiQFhj5RITuGZfFNhMBz0VEFXF0FWWlvW+EeMgkv83h0QnIjVM9NCcVmOV KdMhq4rlRubrtlKAumP/3rSpjvUlzjXQZZKFoOc2MsT0POOyMF6RtY1iYWTTTtKws2n7 ULy/9KHv8T+bPgPiftWpDJzdWqu/nJapBQHxHKXInwHXulYgcXw3Ip7WKfUByPENzpP4 WSTt3yb8IYqBTTXDFIBCTR59sl/SiZ7SX6o7+hsA7qv1rWuxRMbAoxap8cBvP/3eift0 kSZA== X-Gm-Message-State: ABUngvfrxMudeMpAgS751mYUGiqp9P+uLIWUP2VT5FjmrWWEzpf5p6HAgSv7dTbbh0A5AbEipof88/NAW0eCMw== X-Received: by 10.28.113.13 with SMTP id m13mr4697698wmc.39.1477771607030; Sat, 29 Oct 2016 13:06:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.158.8 with HTTP; Sat, 29 Oct 2016 13:06:46 -0700 (PDT) In-Reply-To: References: <44244cfd-c8ad-e0a9-4e70-380a8a8c940c@syberisle.net> Date: Sat, 29 Oct 2016 22:06:46 +0200 Message-ID: To: Levi Morrison Cc: David Lundgren , internals Content-Type: multipart/alternative; boundary=001a11479208b24263054006839c Subject: Re: [PHP-DEV] Allow Iterator to be used with current, next, reset, key functions From: nikita.ppv@gmail.com (Nikita Popov) --001a11479208b24263054006839c Content-Type: text/plain; charset=UTF-8 On Fri, Oct 28, 2016 at 2:43 PM, Levi Morrison wrote: > On Wed, Oct 26, 2016 at 7:42 AM, David Lundgren > wrote: > > Greetings, > > > > As suggested by several reviewers of a PR[1] I recently submitted, I'd > > like to get feedback on letting custom Iterators be used in the current, > > next, reset, and key functions. If this is something to move forward > > with, I'll need some help with the RFC process. > > > > Recent experiences trying to use these functions with a custom Iterator, > > and a bug[2], led me to try and fix this. BC will occur when an object > > implementing Iterator is passed to one of the functions, as the > > interface methods will be called, instead of returning the objects > > properties. The old behavior should be maintained for classes that do > > not implement Iterator. > > > > [1] https://github.com/php/php-src/pull/2176 > > [2] https://bugs.php.net/bug.php?id=49369 > > > > Thanks, > > Dave > > -- > > David Lundgren > > dlundgren@syberisle.net > > 808.639.0365 > > GPG: 0x26F54D7F > > > > -- > > PHP Internals - PHP Runtime Development Mailing List > > To unsubscribe, visit: http://www.php.net/unsub.php > > I can't seem to recall specifics anymore but I do believe some people > would greatly prefer to remove the internal array pointer for > iteration and deprecate these functions. Maybe someone else can > remember more? Nikita and Bob, maybe? > Yeah, I'm one of those people. In PHP 7 the most important user of the IAP, foreach, was switched to use a more robust mechanism. I believe that at this point, the concept of an internal array pointer has outlived its usefulness and we should be working toward removing any APIs that publicly expose it, including each and the next/current/key family of functions. I will propose to deprecate each() in particular for PHP 7.2, because it is both more problematic and more useless than the others, but I'd like to see the others go away in the long term as well. If people want fine-grained control over array iteration, they should use an external iterator (aka ArrayIterator), not an internal one. Nikita --001a11479208b24263054006839c--