Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93265 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 50305 invoked from network); 12 May 2016 10:33:16 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 May 2016 10:33:16 -0000 Authentication-Results: pb1.pair.com smtp.mail=me@daveyshafik.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=me@daveyshafik.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain daveyshafik.com from 209.85.217.179 cause and error) X-PHP-List-Original-Sender: me@daveyshafik.com X-Host-Fingerprint: 209.85.217.179 mail-lb0-f179.google.com Received: from [209.85.217.179] ([209.85.217.179:36708] helo=mail-lb0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7F/6A-28272-BEB54375 for ; Thu, 12 May 2016 06:33:16 -0400 Received: by mail-lb0-f179.google.com with SMTP id h1so8734083lbj.3 for ; Thu, 12 May 2016 03:33:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daveyshafik-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=jXAUbwjnEqLiji3CTn7bd1rxzHYC3fLrtJc7vAVxYBE=; b=VWOP7/rYVg3WxdoJVJ1cCnMhMwatokuc5k8Sxw257ZkvYGNuT8OUVIs3iUo3aWjAzM KIr3bjkapS33wisD7omqd2mu0+T5m6Jx78aqVb/ZHUyvSmBN0P+zSr/ro7xnd/j4E2Gl 9W0pu70hngXWYGZnwbR5MLibETElfX1y65EbrSV2uPxkmjfSwDvqPEm4V7xKph8EfvGw vaMhMQBiihy8/SggyDB2fr1+dTi7pvLiW4PXK6GDb/xQXOv42qDYOERwum8wYvjm5eOP JSwgankxwRk3JH1jkusoaSUzyZZlCaS1jxxDyRLTaU6nOub7/9J+kmZflPqIMWrVR+57 c9IQ== 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=jXAUbwjnEqLiji3CTn7bd1rxzHYC3fLrtJc7vAVxYBE=; b=PGIfAYACt7W3bkON1fDTFzEZA8kpaYQGmfi1jQPZaujgZ/LIJaAQ+WmyR2rG2Dakli bT68O3j+vkBT1P4fnZsLXsAIz1Gxv6PTJcr5iK7XmjQgsk7GCJ044fvi0lBpTeoHHICX T9jo+SDQMYLIEctlbBbPyVes7c082j90jMC9oqp7AlsLlxe8t9bGA68ldY40BQ97OHJi edoKeyZ4TUFXEQ4uzyQHVDZIUeMxI5pJU4MtkTzwWsKTfsbsNdoHRJu74EnMPzUh04S/ YYRs7Gzzd2WCJuKIvKY/fUpAYT2xZk7vug35j/FXp4QGYI/pjjdfdUfjRrggcvveyKLt oLgA== X-Gm-Message-State: AOPr4FWVaqOxh+885yd+a0HmNIsZupm4sv8j5SD/DVnj7QCRc6zsC5W4DIyMBtd7cYR9MX+MkfDI7GmGuy4PmUJD MIME-Version: 1.0 X-Received: by 10.112.171.229 with SMTP id ax5mr3985597lbc.115.1463049192249; Thu, 12 May 2016 03:33:12 -0700 (PDT) Sender: me@daveyshafik.com Received: by 10.25.28.10 with HTTP; Thu, 12 May 2016 03:33:11 -0700 (PDT) In-Reply-To: <1463008795.1856219.605250569.74618FC4@webmail.messagingengine.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> <1463008795.1856219.605250569.74618FC4@webmail.messagingengine.com> Date: Thu, 12 May 2016 12:33:11 +0200 X-Google-Sender-Auth: 6KPtT2-BQJa5vAavyjKo6Fv2frU Message-ID: To: Larry Garfield Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c36ed664bbcf0532a2afba Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: davey@php.net (Davey Shafik) --001a11c36ed664bbcf0532a2afba Content-Type: text/plain; charset=UTF-8 On Thu, May 12, 2016 at 1:19 AM, Larry Garfield wrote: > 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. I wonder if it's possible to use $$ only when it's necessary to pass in the argument positionally, that is, if it's not used on the right hand side, it's passed in magically as the first argument, otherwise it's passed in wherever the $$ (or whatever other placeholder you want) is used. _OR_ we just prepend it to the argument list used on the RHS. I noticed that Closure also have ->> for passing in the argument last, vs -> for first. I'm not sure I would like to have |>> for example. I think that $$ as a positional placeholder gives us the most flexibility. $$ is super easy to type, apparently is possible with little conflict to existing syntax, etc. I'm +1 on |> and $$. - Davey --001a11c36ed664bbcf0532a2afba--