Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99702 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 30393 invoked from network); 3 Jul 2017 13:42:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2017 13:42:23 -0000 Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 74.125.82.49 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 74.125.82.49 mail-wm0-f49.google.com Received: from [74.125.82.49] ([74.125.82.49:34875] helo=mail-wm0-f49.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 2D/C0-15131-EB94A595 for ; Mon, 03 Jul 2017 09:42:23 -0400 Received: by mail-wm0-f49.google.com with SMTP id w126so168927278wme.0 for ; Mon, 03 Jul 2017 06:42:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=CwfcWETP13yJGHRcRWP1IlK7efsY1bm72iXQV5egzLM=; b=voEqFsxyRVaaexN9sIGoNK2zzlhYLM0NrMmvxyJkrtzA1fZ27qQFHJEtT/QBGHvWfV B7BLJSGACTL7FVi8rLWtdeb6OIRhmA/0kY8nvpO3CkPBr+dy3YlTo/fbizIBoVW3Y+NL Gsf2X8ZzqIW5cA0lFxoAu0pXKLR89gtPI9G/khoftqNxqNqlRqcTBS09FIjc5f9q2FSy 94VsPOjx52icVPFDW0diFLsAk/Y25QAgo1tvHVx9JnrHnrwrBr3RTvZdtAJDXWzMEpnQ 79TVXRB/QpNmxc1L0PcegOhiKBvyPI96Laef7+zU1ZSLcB6vmT0ZyaOIw6dMcP883P9P FJTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=CwfcWETP13yJGHRcRWP1IlK7efsY1bm72iXQV5egzLM=; b=iGYsrBNjO4UaJd7wARaFDXXo9OA7jpsNBjSdf3wX6vxlY2oyzxz4EY2RgUu0zc5w91 xtu603wC0zzUWQ2eu5OJib929ATaOq8HKlWwVaNFgVNhwINzd5ylZLyz7MnjwBs7KETI QOkSe5jgJ9IYX/GKmcs0vYK2XwqR83ded3zAaTLj6IX4G1o/9+8o52kdmRuVt1dAU1Gx vF+UxIR9W+/TmmKDSPcOmXenSuPiFM5LvT+e6UyAPY5OKCJohML09l1tyEu+Az8u1r5a ws+wgeCCVrUWfXBt/hkj7U5OlDT9ztqiXLmo6jF1aXFUL4mj3IzPOYypZmYEiXebpHa0 EJNA== X-Gm-Message-State: AIVw1119YpDOSJ1ba/jLzmR+2mWj++giIOC1ZTi26sVzX3UKn+g9AaAP PaDuoayf3iGeL9QXfPhsF7fR1TuHMQfJnng= X-Received: by 10.28.126.67 with SMTP id z64mr4079921wmc.65.1499089340025; Mon, 03 Jul 2017 06:42:20 -0700 (PDT) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.223.169.139 with HTTP; Mon, 3 Jul 2017 06:42:19 -0700 (PDT) X-Originating-IP: [71.251.16.204] In-Reply-To: References: Date: Mon, 3 Jul 2017 09:42:19 -0400 X-Google-Sender-Auth: RRrYfph1Hpc1XLm1CJEWsoHVON0 Message-ID: To: Andreas Hennings Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] "Reader" as alternative to Iterator From: pollita@php.net (Sara Golemon) On Sun, Jul 2, 2017 at 10:49 PM, Andreas Hennings wrote: > (I wanted dedicated reader classes for different return types, e.g. > one "RowReader", one "AssocReader", one "ObjectReader". So here I > would need one adapter class per type. But let's focus on the simple > case, where you can use the same reader class.) > You need that anyway. If the current iterator returns one type and you want to transform that into another type, then you need something to actually do that. Having a reader interface won't magically know that you want to change the output type. If I'm misunderstanding that, and you're saying that the output type of the original iterator is already different and you somehow need a different proxy to blindly pass through the different type then... No. You don't. A single reader adapter will handle whatever type you pass through it. > the adapters also make stack traces heavier to look at. > That is the only slightly compelling argument I've seen so far. Not compelling enough IMO. > The main purpose of the generator syntax is to simplify the code. The > need for userland adapters defeated this purpose. > ONE adapter, which lives in a library that you don't touch once it's written. That doesn't defeat your purposes at all. That is, in fact, identical to having done the implementation in the core, expect when done in userland you have the opportunity to use it tomorrow rather than in December, and the ability to fix any bugs immediately rather than on a release cycle. > Native readers would have made generators worthwhile for my use case. > You've yet to demonstrate that they are not worthwhile. > The idea of "dedicated reader types" e.g. Reader could be > added to "Open questions".. > You have yet to demonstrate the need for dedicated and/or templatized reader types. -Sara