Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98598 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 5644 invoked from network); 20 Mar 2017 01:22:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2017 01:22:41 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 84.19.169.162 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 84.19.169.162 mail.experimentalworks.net Received: from [84.19.169.162] ([84.19.169.162:60326] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0A/B6-18522-FDE2FC85 for ; Sun, 19 Mar 2017 20:22:40 -0500 Received: from [192.168.2.34] (ppp-46-244-187-212.dynamic.mnet-online.de [46.244.187.212]) by mail.experimentalworks.net (Postfix) with ESMTPSA id C6E1352C25; Mon, 20 Mar 2017 02:22:36 +0100 (CET) Message-ID: <1489972951.29726.2.camel@kuechenschabe> To: David Rodrigues Cc: Niklas Keller , PHP Internals Date: Mon, 20 Mar 2017 02:22:31 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Let range() return a generator? From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Fr, 2017-03-17 at 04:02 -0300, David Rodrigues wrote: > I guess that a lot of PHP functions that could be replaced by a > Generator (basically all array functions like array_values(), > array_keys(), etc). > But there are a big question: could it be applied to any case? It will > be faster than just an array? Certainly it will be more memory > optimized. It's quite complicated - these new functions would have to keep a copy/reference of the original array. Also we'd have to allow iterators as parameter for array functions and we couldn't do everything, as result of some of these array functions are stuck into other array routines etc. johannes