Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109786 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 75742 invoked from network); 22 Apr 2020 19:37:51 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 22 Apr 2020 19:37:51 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9F71A1804CD for ; Wed, 22 Apr 2020 11:09:35 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS11403 66.111.4.0/24 X-Spam-Virus: No X-Envelope-From: Received: from out2-smtp.messagingengine.com (out2-smtp.messagingengine.com [66.111.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 22 Apr 2020 11:09:34 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 67C485C0246 for ; Wed, 22 Apr 2020 14:09:34 -0400 (EDT) Received: from imap7 ([10.202.2.57]) by compute7.internal (MEProxy); Wed, 22 Apr 2020 14:09:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=0zramG fe1NHsQZzeNcsAYlt0QGLZRNUpEnY7kOMgWqI=; b=FprvXhtWE0eDsxf+CWYAPk vtNlHI2vj/qKe1Hbd5hyeqzAJ3AlMJCIq9r2kZdTE1J0T1a7k64dV60xiJMXFhdJ 5NN5KmE3Liu9p0ntxsIzUooHei2iaV6iOpm/CBBbJ0b5xkCuFz+eLfi1sCE8x1xk sBeT7AmPzL+4rMJvSbcaUQW458DMfVPXA6KB/fCaGs7vDNUWpEDJ1n69u2NBBy17 6CU7I9yeec3d1+Qi6lSZcMFRu+6JH3ylqffwravOsZHZWYZZvNV8hOee6X3dHnvG kY/7mW7zju9I204pGuvhDWTgf1DZEyZwE9bXbpD36EEa6vxB3c9vNsSw5Pi9jYIg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeejgdduuddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdfnrghr rhihucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtoh hmqeenucffohhmrghinheplhgvrghrnhihohhurghhrghskhgvlhhlrdgtohhmnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesgh grrhhfihgvlhguthgvtghhrdgtohhm X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id E07EF180093; Wed, 22 Apr 2020 14:09:33 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.3.0-dev0-351-g9981f4f-fmstable-20200421v1 Mime-Version: 1.0 Message-ID: <126fcb4d-f55d-48e9-835f-76b84a903a5f@www.fastmail.com> In-Reply-To: References: <2677cdc6-309c-4e4e-9cd9-12ff2a90c1e1@www.fastmail.com> <93A509E9-E6BC-425C-A584-F49F094E75B0@benramsey.com> Date: Wed, 22 Apr 2020 13:09:13 -0500 To: "php internals" Content-Type: text/plain Subject: Re: [PHP-DEV] [RFC] Function pipe operator From: larry@garfieldtech.com ("Larry Garfield") 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