Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101725 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64087 invoked from network); 29 Jan 2018 21:37:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Jan 2018 21:37:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=tendoaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=tendoaki@gmail.com; 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:41902] helo=mail-yb0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0B/CC-24062-0149F6A5 for ; Mon, 29 Jan 2018 16:37:20 -0500 Received: by mail-yb0-f182.google.com with SMTP id t14so3382563ybc.8 for ; Mon, 29 Jan 2018 13:37:20 -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; bh=kLOuA/lGf84Ze05RjcVI6/h5LPDT+derp2AnTlE+oVY=; b=J7KRqiR6mFA4+D2qwdeQxOHPFBSxtwAOvaM17Ckfuluzb5W4JIBpLsPFhsTDDngTUq +QI4jY2SvGkn9rMKmmj+SQcmLMTuOvHtkdA5fJW3v0/uQLYjfx+4ddKHae7p848H1dza ueEd/Oqfvu0mPDm3y4Oo2YpqFH9ikeUWEbIN44j/Tgv5+ArWk3jYz8GCiWRDbS2BjLAZ y5KLlnD0v0OCdUhpC9MnYezcGuSjYIOZe0PhgJBKeJhrh8s+z3wtR69+oc9aABcUSK5p ICAkJu56Vq40zFw37VTlYE2pI8j4rHFHmc4GuduzPFBPvycYUWDKT/BdlaQDwali/fLh zSjw== 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; bh=kLOuA/lGf84Ze05RjcVI6/h5LPDT+derp2AnTlE+oVY=; b=pPem1J4H7WCWCJB6HuMHAZ3g90F2E1RqFcej8qlmEYEwDrRmHeJzJInayZsP3UOazT NnCDDFDJvlbmVaENTyH25L8mMRNjY8CCp7K3VlrvG53TVyPnDf1tbC5Ofrrsi84DTiRF LWflkWWjeF7HRsttvVtXAII9ixrr7Rx7JW1HukUmyXccZH9lJ1hXIZVVN8K33Psng3Ij 39NpRP4q+xgm4pu0Ux7Cuyic7OjUoAYTHuxlH96TJTvnqtK8P1qQAG/PJajSzF/E72pJ JHbT1VlzlwRDU+dvvdn+eOdqqyoOk9Lp4XCehDzNUSac3tDF3vg/XvPuAcBHxAbDLreM eVDQ== X-Gm-Message-State: AKwxytcBVsrjFMJzpTcJwNQCo/FwH4iNWiQWcyyxmXSEZ24WbaXMYerp wIqeOwli9CG2Zi78opn3wwut+S0O2dhD7vqcK5Y= X-Google-Smtp-Source: AH8x226xYbwtCYCGFdQAblzTxSN5A4d4hzOpGuScKQdu9sZXqnQ2PQTapkVIYhFJ6JkdrMPIx+w6s4JX9f9DgfZs6Yk= X-Received: by 10.37.77.6 with SMTP id a6mr3629752ybb.410.1517261458481; Mon, 29 Jan 2018 13:30:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.37.189.16 with HTTP; Mon, 29 Jan 2018 13:30:58 -0800 (PST) In-Reply-To: References: <9b12b0e2-185e-86fb-0e0b-c4f24bfbd661@gmail.com> Date: Mon, 29 Jan 2018 15:30:58 -0600 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="001a113bddf443a5d40563f0f61b" Subject: Re: [PHP-DEV][RFC][DISCUSSION] Collection Inspection From: tendoaki@gmail.com (Michael Morris) --001a113bddf443a5d40563f0f61b Content-Type: text/plain; charset="UTF-8" On Mon, Jan 29, 2018 at 3:26 PM, Rowan Collins wrote: > On 29 January 2018 19:14:43 GMT+00:00, Michael Morris > wrote: > > The is_callable() > >above prevents iteration over generators, potentially consuming them > >for no purpose. > > Unfortunately, it doesn't: it's not the generator definition that you'll > be passed, but the Generator object returned when you run it, and that is > not callable https://3v4l.org/rknQJ > > (The definition is more like a constructor, and I wish it didn't look so > much like a normal function in declaration and use.) > > 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). > > Ok, so make no attempt to keep people from shooting themselves in the foot eh? Fine, is this otherwise workable? --001a113bddf443a5d40563f0f61b--