Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93059 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 58359 invoked from network); 4 May 2016 01:48:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 May 2016 01:48:00 -0000 Authentication-Results: pb1.pair.com smtp.mail=jesseschalken@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jesseschalken@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.180 as permitted sender) X-PHP-List-Original-Sender: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.213.180 mail-ig0-f180.google.com Received: from [209.85.213.180] ([209.85.213.180:37268] helo=mail-ig0-f180.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/DC-03860-EC459275 for ; Tue, 03 May 2016 21:47:59 -0400 Received: by mail-ig0-f180.google.com with SMTP id s8so36190985ign.0 for ; Tue, 03 May 2016 18:47:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=+3uZcOM1DxF8ITj5A4er1CDH6r8HDgGzol9qzaihPzs=; b=AKQFoKV1/ZVSmEs2KMqkNFyK6uhwl4+DUFBiC/nKZxBWT7X3gLnIym0u1ALESIooyW AdN3eRDETYNwN9wNdEVTE7/5EyXsnee7YsZqUq1lPUVgPYTIjkJnaWGLPwgH+RzB8b7x b4VREuNVTzpVcKJipsqCASoFhxA6eFDNJK3RVMcyHTqBm/SI9EKE/IOpLY1oWk0Ma208 Qe/kutBVNu5GrEZE3SdhBuBHP2uzmx8vcVYJZCJcbMeg+2GgitGDuPiSmi1lJI2e4wR1 wPG5wyt1Sm7qmaf+dBpOjgYZ/Laymo0DskObIx7pKY1t0PDhlRBN7wojFz6N8ix24tFv VMHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=+3uZcOM1DxF8ITj5A4er1CDH6r8HDgGzol9qzaihPzs=; b=CmTt7b4/fEy67q+tz2Yksti3zy5tvY4zhvUus89D+dd53o8kvvzwk8CvzBKEIkRfgU kg80XnwzLBMLOPezoYDMe0oXTinsfwbebCHcrWtzFE9QOhi5nlPWD6B74TEY1GZWOLcA t6xO++Z+QSRPFSDnu/2wTLTkyq/pQLZKwaRtQ+UgVYO1GHdFUquGhrlPRS5Q4LEq3GUv nHzzcFF+3NPbmCxgB+PdGfHEe1Y+jE34jHKjR4uuFEE/tsOM3PKo9n3r5f/g9T+4O38J SWq743O14DThtHT/vtPLAr+qp5xeuf6cHYbSG3+elujepthRJGaIEJjWMPTwkgOmXPlN aeyg== X-Gm-Message-State: AOPr4FVoD3Crkz9B/+30LJyCPNZwhn6z07wV85A97TFaZvM3GHC929Lb2n0KOlQ2JZPHXpm5pSc/o8oQBYDxNw== MIME-Version: 1.0 X-Received: by 10.50.28.113 with SMTP id a17mr7234134igh.44.1462326475944; Tue, 03 May 2016 18:47:55 -0700 (PDT) Sender: jesseschalken@gmail.com Received: by 10.79.139.133 with HTTP; Tue, 3 May 2016 18:47:55 -0700 (PDT) In-Reply-To: References: <4fc01507-3d07-2309-a4e4-4cad7325249b@gmail.com> Date: Wed, 4 May 2016 11:47:55 +1000 X-Google-Sender-Auth: YtYpWVy8KGa3LSsuCh60Uprxt7s Message-ID: To: Terry Cullen Cc: Stephen Coakley , internals Content-Type: multipart/alternative; boundary=089e01538ac8252d0e0531fa6a10 Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: me@jesseschalken.com (Jesse Schalken) --089e01538ac8252d0e0531fa6a10 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Tue, May 3, 2016 at 12:53 PM, Terry Cullen wrote: > =E2=80=8BDoesn't Nikic's scalar objects (https://github.com/nikic/scalar_= objects) > more or less achieve the same thing while also cleaning up the std lib? > > $ret =3D scandir($arg) > ->filter(function(){}) > ->map(function(){}) > ->merge($someOtherArray); > This type of solution is only applicable if the operations to be chained can be bundled with the definition of the type itself, and are generic enough that they should be. Consider the pipe between scandir() and array_filter(...). Suppose I already have a function or method removeDots(array $paths):array which I would like to use: $ret =3D scandir($arg) |> $this->removeDots($$) |> ... If the solution is method chaining, then either removeDots() has to be added to PHP's built-in array type, or scandir() must return a specific class (eg FileList) which has such a method, instead of a simple array. Either way, the author of either scandir() or of the "array" type must predict what operations the user is going to want to chain. That isn't knowledge they necessarily have, especially since the operations could be entirely specific to their use case. With the pipe operator, all three of the left hand side, right hand side and the type flowing between them can belong to different codebases. --089e01538ac8252d0e0531fa6a10--