Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109768 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 18390 invoked from network); 22 Apr 2020 09:54:27 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Apr 2020 09:54:27 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 611161804C2 for ; Wed, 22 Apr 2020 01:26:05 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 22 Apr 2020 01:26:04 -0700 (PDT) Received: by mail-lf1-f50.google.com with SMTP id u10so914239lfo.8 for ; Wed, 22 Apr 2020 01:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uniwVzTVxNZF36fR0JN0glUkPeqbc+tlTbQ5YGoS2yg=; b=KWWKwxCaNk03N5bqXJkXj/fuUvW2gy+VnZx+umKqq9k2jsp4mWCP5hrVKT2rnojaqg pjjciNakOlM4Dnch0an4nOG4Dnf0VONWvoY2HyR6IJHD8+xDY6i9rU+r5ouNgXmS903p bNWxWueywxPEAow1OZI2JYcl9c00X0XkqrMTlcpiZ9tF0tccnl8+xYd7zr6/f0E2pVpc mAfMYZTF4DzI9RrTC9CGKyExWzlVnMGJJtB/WScEYNbwGZDUzLrjL78pU21RWClbcTiC tvjZZudKeQQlYGDcarH7TPyEFU0VeLMcAKaomkDmyXgfSOa1FwU77NiyQCcBZOndHHeL mHQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uniwVzTVxNZF36fR0JN0glUkPeqbc+tlTbQ5YGoS2yg=; b=jzZ7FiN8/HJZqugrvX13Bymr/ARIBSh5/KzWA3GFnY9A4CEK47CehpnSeVS1JQ9vTa C4IsXP5Yo0lGcpBWilMruLPK4AylWfQgdCHDaM6mQj6en66uRh6dEsjEJNAQmzhgcdLz wom+cdJirGJq2910LBRS9qBytq3HipmLR1cwn2Tz7aWc6wkvw/2bqujm5BzwHy42OH3i mAhYTEpG6RTUWEgVou8Pdwi5dFWR1lK4EKhXWxI7Okr5ZRn7TV0F6hG3FBXm4gFmpV8U fyFCZUzXonZvtE1gUdlrhJF1Zk3nHOVUj68SyWqJDZwXhvEnggNrKYYHdqYI3JihxiRw Rx0A== X-Gm-Message-State: AGi0Puaw1uUUb+v27nkDKM6H1iuz2gtsgmKrMcmYluoL6e5MBeiJIPKw yeIX8PDuoJTmX6q7Vqvnumtz6KaP6ihPRnPrabs2FJc= X-Google-Smtp-Source: APiQypJLlECP8NGbSuZlZHHvvZovpd633MvD6U2A9NieRp7byj1tSDLReGU8FsUfdWA3zjn2FoXC0dFcEInBShkZ4qY= X-Received: by 2002:a05:6512:308c:: with SMTP id z12mr16154335lfd.195.1587543961252; Wed, 22 Apr 2020 01:26:01 -0700 (PDT) MIME-Version: 1.0 References: <2677cdc6-309c-4e4e-9cd9-12ff2a90c1e1@www.fastmail.com> <93A509E9-E6BC-425C-A584-F49F094E75B0@benramsey.com> In-Reply-To: Date: Wed, 22 Apr 2020 10:25:50 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Function pipe operator From: guilliam.xavier@gmail.com (Guilliam Xavier) On Tue, Apr 21, 2020 at 4:44 PM Larry Garfield wrote: > > On Mon, Apr 20, 2020, at 11:20 PM, Stanislav Malyshev wrote: > > Just a small pedantry note - in a comparison section, the RFC compares > > this syntax to function composition. But this is not function > > composition. This is a syntax sugar for calling two functions one after > > another, not operator that produces a function. It sounds pedantic but > > it's rather important distinction - if |> is composition, than $foo |> > > $bar is a new callable provided $foo and $bar are callable (but no > > function is actually being called here!). If |> is call syntax, it's > > actually the result of calling $bar($foo). > > > > So comparing it to function composition is a bit confusing. Otherwise it > > looks OK to me, except the syntax for calling functions and methods is a > > bit awkward, but it's not the problem of this RFC I imagine. > > I'm not sure I follow. The only place composition is mentioned is in the F# section, where it calls out specifically that we're implementing "pipe forward" and *not* the composition operators ( >> ). Is that unclear? Actually it's also mentioned in the Haskell section, but as "function concatenation" (which adds to the confusion I guess). Speaking of Haskell, that reminded me of http://learnyouahaskell.com/a-fistful-of-monads#walk-the-line where the author defines a custom `-:` operator such that `x -: f` desugars to `f x` (equivalent to how `$x |> $f` would desugar to `$f($x)` with the RFC), which allows to write e.g. `xs -: sort -: reverse` instead of `reverse (sort xs)` or `(reverse . sort) xs`. -- Guilliam Xavier