Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93255 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6148 invoked from network); 11 May 2016 23:19:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 May 2016 23:19:59 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.29 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.29 out5-smtp.messagingengine.com Received: from [66.111.4.29] ([66.111.4.29:42403] helo=out5-smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BD/04-28272-E1EB3375 for ; Wed, 11 May 2016 19:19:59 -0400 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id BE00C20807 for ; Wed, 11 May 2016 19:19:55 -0400 (EDT) Received: from web6 ([10.202.2.216]) by compute3.internal (MEProxy); Wed, 11 May 2016 19:19:55 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=b5vgzaZPwOhWwQm 5a0TPpc1fc9o=; b=CEQCUn3q75tGWZJ51T3eHbLUAQ/wk6jfoUJTp/2UbvdLsA6 gDbTsSlXo6b4TUIMn3XctBT65WBEsH/ALr+LdfuEd74ayVskbYY9y7LmcjpxavQw xBcVRzFIaMkvylimCZXtwkJCIEw6Cr9tVM5QGRJTq2uhn3mEcTx0QZrNOk7s= Received: by web6.nyi.internal (Postfix, from userid 99) id 8577272BBB5; Wed, 11 May 2016 19:19:55 -0400 (EDT) Message-ID: <1463008795.1856219.605250569.74618FC4@webmail.messagingengine.com> X-Sasl-Enc: 4SxXQeY5fkGWqs4+ifVQC0Jqz0GnBMKXKg4rCQCWjAo2 1463008795 To: internals@lists.php.net MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Mailer: MessagingEngine.com Webmail Interface - ajax-de9b841d Date: Wed, 11 May 2016 18:19:55 -0500 In-Reply-To: <7c94ca37-e188-dd2b-a66f-bb63bf03041a@gmail.com> References: <39071a01-a42c-0952-b3a8-b4769c79b56b@fleshgrinder.com> <0ac3be89-6fb4-610a-ef89-0928f264f96c@fleshgrinder.com> <71379db5-b7b8-78b3-ada5-eee34e6e22d6@fleshgrinder.com> <452ddb93-1f47-1d0f-4f24-bedbff506b27@gmail.com> <98.61.11104.A1D41375@pb1.pair.com> <7c94ca37-e188-dd2b-a66f-bb63bf03041a@gmail.com> Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: larry@garfieldtech.com (Larry Garfield) On Mon, May 9, 2016, at 10:21 PM, Stanislav Malyshev wrote: > Hi! > > > |> seems like a common symbol to use, but it admittedly does look a > > So, usage in one semi-obscure language (F#) and one completely obscure > one (Elixir) - Clojure doesn't use |> - and one proposal for Javascript > now qualifies for "common". And that counting the fact that neither of > them actually uses the worst part of proposed syntax - magic variable $$. > -- > Stas Malyshev > smalyshev@gmail.com If the issue is $$ feels too Perl like, what is the alternative? Is there another way to chain methods cleanly? In a sense, what we're really talking about here is continuations. Continuations (over-simplified) are a clean way of setting up "run this function, pass its result to this function, pass its result to this function, etc." That makes composition really easy. |> is essentially a continuation syntax. The $$ is to work around the fact that PHP function can have an arbitrary number of parameters, whereas continuations work best with single-parameter functions. Of course, with currying any multi-parameter function can be reduced to a series of single parameter functions. So what if we were to limit the concurrency syntax to single-parameter functions? And if you want to reduce a multi-parameter function to a single parameter function, yay closures. Would that limitation help or hinder? Either way, I firmly believe that more functional-friendly capabilities like continuations, promises, etc. are a direction that PHP needs to move, and syntax in that direction is valuable.