Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109791 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 43624 invoked from network); 22 Apr 2020 23:00:24 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Apr 2020 23:00:24 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F0BE71804CE for ; Wed, 22 Apr 2020 14:32:08 -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,HTML_MESSAGE, 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-il1-f177.google.com (mail-il1-f177.google.com [209.85.166.177]) (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 14:32:05 -0700 (PDT) Received: by mail-il1-f177.google.com with SMTP id q10so3531902ile.0 for ; Wed, 22 Apr 2020 14:32:05 -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=IwS0x5N8jcRKBGIDfOTyY0pm5yizNn7w7Agl6unP3eQ=; b=leTTDiaTrp6bX3L1VQm3N+3fNuRQpFnDmhv+F7DeDxTMtmatw/dH+GCMPXQtrRemJr Y4Q9Nc7JAuco/M/bj40qn1+kg65VN6EWZCE0/c6+TPkqbaGf1fB5oMibsGeLI6xTRvp7 Q4TEtDKmHZQeVKfrPKB7iB8rrRkH219PR0kW+RHjJELk1GZsdt4nli0YGffFj6Pj74SG JpOzAzE7qt1Wej5KW1FNcnSqVhUiIpNQ3GEltu02uXMJNNl/EClCsTQjwIXscPIxm9S3 +cuSyqGNwqDlw7XaXJxLV9AlLtou2sqZriLfAQs2rBs6hbbypksej3qM+noD6JAj/jpk yUKQ== 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=IwS0x5N8jcRKBGIDfOTyY0pm5yizNn7w7Agl6unP3eQ=; b=Y9AlD0lYOGPBTi/JIoTBm46nXONYpyc9n0e+Rcr3Zy6kUYHl6SxszFtqP1Gtqrb2qc wqCk/V3Wsjt4pCrKnvgvzIZvYbC5ANl6kL1n+hf2Ytt3XTQuSL7xMKvJP+ZbEIWCl6m5 lSnCiPX+V0MgeygEWqc192cnJh7NjcHsTy8WaO2ul0asv30kZ0+I69CYO3m2cykrB81g YSlSUsX/ik4nyxG0CzQx5TtdPG/kcEXV9zOUsESp+HpyDS4zCIJEkn9GGee4WZ5srKZx CfJR5SeI9Bw1wbvd+TCsx82dcyMN0Ufo01N11PH5gAkO8FSQyC9ilkHVIWprlRXOwB5Y sWag== X-Gm-Message-State: AGi0PuYK0HTcK7X0YiLHQMxVdRu9sgPro4+/ExzMFw+9+/vCAVo2bs+L 86tSrkTq7y9sw59d0GRUNxG5Wv26zcfYKyJXrbw= X-Google-Smtp-Source: APiQypJYn/w5bvATB9OLNh+LEMZPQ8O2w1Bk9gsUlxJ2icAF084XlAmlaDshvTAhpvTZBxQ18tDFrNTlvm5r7JlXTWo= X-Received: by 2002:a92:7303:: with SMTP id o3mr419981ilc.275.1587591124299; Wed, 22 Apr 2020 14:32:04 -0700 (PDT) MIME-Version: 1.0 References: <2677cdc6-309c-4e4e-9cd9-12ff2a90c1e1@www.fastmail.com> <93A509E9-E6BC-425C-A584-F49F094E75B0@benramsey.com> <126fcb4d-f55d-48e9-835f-76b84a903a5f@www.fastmail.com> In-Reply-To: <126fcb4d-f55d-48e9-835f-76b84a903a5f@www.fastmail.com> Date: Thu, 23 Apr 2020 00:31:52 +0300 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="00000000000003359605a3e7dd4f" Subject: Re: [PHP-DEV] [RFC] Function pipe operator From: weirdan@gmail.com (Bruce Weirdan) --00000000000003359605a3e7dd4f Content-Type: text/plain; charset="UTF-8" Haskell has & operator in Data.Function module which is exact equivalent of the proposed feature. Link: https://hackage.haskell.org/package/base-4.8.0.0/docs/Data-Function.html#g:2 Example: https://repl.it/repls/KindLightsalmonApplicationserver On Wed, Apr 22, 2020 at 9:09 PM Larry Garfield wrote: > On Wed, Apr 22, 2020, at 3:25 AM, Guilliam Xavier wrote: > > 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). > > Ah, I see what you mean. I've adjusted that section to be clearer about > what Haskell does. > > > 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`. > > If I ever actually wrote Haskell, I'd find that extremely useful. :-) > > --Larry Garfield > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Best regards, Bruce Weirdan mailto: weirdan@gmail.com --00000000000003359605a3e7dd4f--