Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87523 invoked from network); 4 May 2016 09:08:03 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 May 2016 09:08:03 -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.223.182 as permitted sender) X-PHP-List-Original-Sender: jesseschalken@gmail.com X-Host-Fingerprint: 209.85.223.182 mail-io0-f182.google.com Received: from [209.85.223.182] ([209.85.223.182:35041] helo=mail-io0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1E/A1-08540-2FBB9275 for ; Wed, 04 May 2016 05:08:03 -0400 Received: by mail-io0-f182.google.com with SMTP id d62so47828737iof.2 for ; Wed, 04 May 2016 02:08:02 -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=mhKa5D63nfiC+qkv4sITwzaOy3oGx514Kyhzzvp2VAk=; b=0mS9ZjAr8IwkvoRNkYW4jKfRz4iBCjmjlfeRfjWbXjJXXawcWT0FGweZLIAkPsG+z9 Fqh4qT8w5BIdWVFAhAg/ciijeCrdPelixHbKS44jMFe7opbs+rkHi8pqXRElTUSZodCS ftFo6kVL5Y4PALpDsU28mVWAhAt97vzPrImf40ZuXpP8tbSaBWLYWHKp9o7R51yJlYB9 swxdEcLxb6gquSWnlsxGT25P2oLFLuedS6ZU+AtWXFGDc8/Npm2ijcFp3oit0xzJmtSr nxitJDo+NC5/t1yeIk9DFS5DuS+AITX52+w1t6/nBY+D+0P5UVxfBEu8+fac2L7YrxYh tCiw== 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=mhKa5D63nfiC+qkv4sITwzaOy3oGx514Kyhzzvp2VAk=; b=BimgSGglcM9tGZC/bEdqbnBQuXU60jzLN6TkOfHcE8KY+I3wRVro579+0l2GtMEl98 L9dtxeWXL/3vc2wQmKFTehFcrYTiqifoWbyUPCPSKa3LKHMHwmjiRdx4JYwRPKIOv/qF swUX8fDx2F3pCW+RzGrTZg0tRP7I02KEOTErwcnVmodKQtACbQNSWbhXySPPGCp3FeQq XOLn2dhbx/fmldtUVyfzm/0uK26nk+DACBaxeFU/HTIB0NcSHwPLmKxGUGn8DyqOLWaF GucJc5xzbTRLY4R0JhbkL9IxSfvEKfSoJhtwewV6wboe0tc431YICMNzTqIRx20cTPbA YtwQ== X-Gm-Message-State: AOPr4FXzkHgkPmRjLfMFppjzGsSR1WQGtVslk+QMZOo9CouMLa0qhvYDBIzLLBppUKyGeVy/VB/tEye14avqwg== MIME-Version: 1.0 X-Received: by 10.107.180.194 with SMTP id d185mr9279493iof.151.1462352880192; Wed, 04 May 2016 02:08:00 -0700 (PDT) Sender: jesseschalken@gmail.com Received: by 10.79.139.3 with HTTP; Wed, 4 May 2016 02:07:59 -0700 (PDT) In-Reply-To: <5724F3F8.5070909@garfieldtech.com> References: <8ea990da-1fe7-256c-4e08-0b30715c8e8a@gmail.com> <5724F3F8.5070909@garfieldtech.com> Date: Wed, 4 May 2016 19:07:59 +1000 X-Google-Sender-Auth: XzrhpVQ4g1udyo4klEmSSZPqQOw Message-ID: To: Larry Garfield Cc: PHP internals Content-Type: multipart/alternative; boundary=001a114f7dbef5d7080532008f8b Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: me@jesseschalken.com (Jesse Schalken) --001a114f7dbef5d7080532008f8b Content-Type: text/plain; charset=UTF-8 On Sun, May 1, 2016 at 4:05 AM, Larry Garfield wrote: > > In a way... Sara, this syntax feels like it's only one step removed from > promises; if any of the chained steps involve IO, it becomes basically what > promises are for. Am I barking down the wrong tree, or is there something > we could connect there? (I don't mean "reject this in favor of promises", > but more "is there something we can do here to be forward thinking, since > lots of people want to see async in core PHP?") > > If you had async/await, you could of course use |> to chain async operations in an async function by using "await $$" in place of "$$" (since $$ would be the Promise/Awaitable): $ret = scandir_async($arg) |> array_filter(await $$, ...) |> ... That's quite neat, IMO, and the features are still orthogonal. You could introduce a new operator to combine the "|>" and "await", say "a|>", but to add an operator just to combine two others would seem a bit arbitrary. You could also generalise |> as a monadic bind (with Promise as the monad for asynchronicity) but I don't know how that would fit in PHP land without a meaningful way to turn an expression into a closure. It could be added later as something like "|>>" if need be. --001a114f7dbef5d7080532008f8b--