Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 62757 invoked from network); 29 Jan 2018 21:35:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2018 21:35:26 -0000 Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.182 as permitted sender) X-PHP-List-Original-Sender: tendoaki@gmail.com X-Host-Fingerprint: 209.85.213.182 mail-yb0-f182.google.com Received: from [209.85.213.182] ([209.85.213.182:41814] helo=mail-yb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EB/7C-24062-A939F6A5 for ; Mon, 29 Jan 2018 16:35:25 -0500 Received: by mail-yb0-f182.google.com with SMTP id t14so3380426ybc.8 for ; Mon, 29 Jan 2018 13:35:22 -0800 (PST) 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=8QBiyV+nsFtAynAgOL8pZyf2vYQRP1hzzUp8rkmbNwA=; b=AAFsXmdYgrINJDYLzlIzGb9UJt5Nfvn1h2MAtLTevhTm5phlPQ75Vd/ynQD+skDwbA +SLcDk/4Oz/NFNFLRXhvJk0SMsmJ40KkvgSux5aaVqBDt0tSq+aJgZnxM+TAJi7s7YZc JvMrl9M5BKuo2mt9MR/dAd320r7GdOhicbzEVXukxbbVNPJdTLsvf2vyg8eEXkyHKlNJ hbC6vHVtzXsatLAKxlBrty61NzlUTE27Kqj8P575QewpZW/tf9kLTM9bRSXVkamEby15 wuCL318Sp4xRSP9JNPAFXEAjgb7TgfVluxEkQlSMQWNiYUyemojT2qfuD/OoRNKgU8Za sq6g== 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=8QBiyV+nsFtAynAgOL8pZyf2vYQRP1hzzUp8rkmbNwA=; b=hUu2EMgI+vE80CuVTDdG1ygDXXPUSx1JUzxbmO5vkgU0hJ14pV3AVBhr+IQs2rKHDf qRnUtZH6YLv4F6GEmxXY0vLKKHWWCfTP/Rqm6XSQXb8GUhc2woOwtDbr+tQv5uXnHiqR vEGfr5/YLYRLQivNXe1q87yXMuZPGSYlf/CqQHTAUcXS4q+Ft1zr+7v0fzyZN7foUR0R VcKHIVRnOWiasV28BuZaiCQFl7pkY2jUA4xXSeVBtPoHMJ8EX7Z+fwScVJw+zJzSfdbx eT7D4CmVWc0FIwqH8PhhKflp5sjOh1eKisiZJ21Bx7WrGaaZR34fU1vcZ27QV4KzRdmX usBw== X-Gm-Message-State: AKwxytfHB3+IDsLimGQYR/MLpDP8h0lShFzV952btQDlEfGbULdkSdM1 51h/m+mSOKyjfWPGzAPdYzxqoCBDuqpIH6oTqCM= X-Google-Smtp-Source: AH8x22680Bxq/DkCAQcWoHr+Xvm5k3N7seFf5JRlW06KultAynVf/zBQVcOx/dANbythqYaCtM+X/VVRgM0QSCegfLs= X-Received: by 10.37.173.75 with SMTP id l11mr19024575ybe.304.1517261719022; Mon, 29 Jan 2018 13:35:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.189.16 with HTTP; Mon, 29 Jan 2018 13:35:18 -0800 (PST) In-Reply-To: References: <9b12b0e2-185e-86fb-0e0b-c4f24bfbd661@gmail.com> Date: Mon, 29 Jan 2018 15:35:18 -0600 Message-ID: To: Rowan Collins Cc: PHP internals Content-Type: multipart/alternative; boundary="f403045ec2a0cb334b0563f10514" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection From: tendoaki@gmail.com (Michael Morris) --f403045ec2a0cb334b0563f10514 Content-Type: text/plain; charset="UTF-8" On Mon, Jan 29, 2018 at 3:26 PM, Rowan Collins wrote: > > Nor are generators the only non-rewindable iterables you need to worry > about, so really the only options you have are to only inspect arrays, or > to add a big fat warning that the function may consume your iterable (or > enter an infinite loop). > > Sorry about the double reply. What about using count() as a guard? While there might be some countable consumables, my understand of generators is they are often used where no prior count is available. Arrays and ArrayObjects are countable. --f403045ec2a0cb334b0563f10514--