Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93127 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95154 invoked from network); 9 May 2016 16:41:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 May 2016 16:41:54 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@golemon.com; spf=softfail; sender-id=softfail Authentication-Results: pb1.pair.com header.from=php@golemon.com; sender-id=softfail Received-SPF: softfail (pb1.pair.com: domain golemon.com does not designate 209.85.215.41 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.215.41 mail-lf0-f41.google.com Received: from [209.85.215.41] ([209.85.215.41:35538] helo=mail-lf0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3C/22-10422-0DDB0375 for ; Mon, 09 May 2016 12:41:52 -0400 Received: by mail-lf0-f41.google.com with SMTP id j8so206034788lfd.2 for ; Mon, 09 May 2016 09:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golemon-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=j4sFfi6+9BFQeHQUXXcY58gvoao9KH82iXWjN7gkkS8=; b=DnbqS1xMlQcQqAGRYfd6s1boe/BtUydT/Exb82HI8dX5ijvCqTuz744c8/919znXuo bwPOAzKGkiVV/nHlA9PrEkNKq7FAv1ZZmCxMTsr9ZLrGBYXWfcFe3n88WqDZLlDbQNoM K5eWN+Ny1nam/ZkcrmtUQW1rbQbQHmjFNDyNa28naVpKQg+5VRX8Cxz0vm3NJeLZAR7n 3ucq3YLEuiID4tiw5Wp7+SBc7vYTJgkDI3MHqNgiJEPSjoHiA+M/kjN1TAPs0OOOk8jc SCSvcBMSloIWErBynSGW+pRl89FCX2uazw5DFwFA8GQDsoGNvN1UO7ksrzkX/LwLKcQA B0eg== 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=j4sFfi6+9BFQeHQUXXcY58gvoao9KH82iXWjN7gkkS8=; b=QqlMvG1XratHmd2VbabTXevd84gdKYL2UMmAkIgtMyfij1DiIJkx1/1s+ISX0tge0Y uOLflTRphNkYI2azJd8neK4We3ECkQbWU3xx2iHlwiPOc7gm5m0Hqar1YDmRHfJao6ee l4MkuQJgmRkUlHZHSSxBZNNrydpRmfT77QfGvzuVDePpRTWCNmWVtJiJzyvq6b0+yHcT EtZF9vm82n4nZ/TD2Fz40VC3inKIALElknoswFZk1tXOgekwHYmmuvtu41ZiDCLgofOA Sy2P7WPNYrkGoxwcnvLwIrPohwI5LgRsqiyS2wkjah/hY4ycQ7Gm8eUeNoILIr21JtB9 MzBw== X-Gm-Message-State: AOPr4FVkYDZVX+5UZrd8dg1/7FghxlsTdAyQ7fHzO3grpWeMvNaZRC5/tdMzyg5Cl8bw65w/fjY9bKoArV6jew== MIME-Version: 1.0 X-Received: by 10.25.20.78 with SMTP id k75mr12722756lfi.82.1462812109195; Mon, 09 May 2016 09:41:49 -0700 (PDT) Sender: php@golemon.com Received: by 10.112.19.72 with HTTP; Mon, 9 May 2016 09:41:48 -0700 (PDT) X-Originating-IP: [107.198.91.68] In-Reply-To: <452ddb93-1f47-1d0f-4f24-bedbff506b27@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> Date: Mon, 9 May 2016 09:41:48 -0700 X-Google-Sender-Auth: i2vhCWdn4aEUsqbsP64iuAoov3o Message-ID: To: Stanislav Malyshev Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: pollita@php.net (Sara Golemon) On Sun, May 8, 2016 at 11:45 PM, Stanislav Malyshev wrote: >> Yep, that's exactly what "->" does. It's just pointless syntactic > > No, not really. Calling method on an object is an universally accepted > phrase in many languages. > I never said it wasn't. I said it was pointless syntactic sugar. > Moreover, there's no easy and more readable way to call methods in PHP, > so -> is the best way to go. > But there are ways to implement "oop" with explicit data passage. Ways which could have been leveraged in PHP3. We don't use those ways because it's a PITA and produces unreadable code. Which is what syntactic sugar is meant to alleviate. > Moreover, calling methods is a very frequent operation, and any time you > need it, regardless of what is the circumstance, you'd use -> > Calling functions, chaining the output of one into the next is also a frequent argument. > Neither of these is true for |>-$$ thing - it does not have any matches > in any languages I can think of. > You lack imagination. Here's three to get you started: Elixir: http://elixir-lang.org/getting-started/enumerables-and-streams.html#the-pipe-operator F#: https://msdn.microsoft.com/en-us/library/dd233229.aspx#Anchor_11 Clojure: https://clojuredocs.org/clojure.core/-%3E And if they seem to obscure, how about this proposal for Javascript? https://github.com/mindeavor/es-pipeline-operator >> Oh, sorry, we were talking about the function version of ->, my >> mistake. That's a totally different thing. > > I'm sorry I didn't get what you meant here. "function version of ->" > makes no sense to me - function version of -> is the function call itself. > $foo->bar() calls the bar() method invisibly passing $foo as its similarly hidden $this argument. $foo |> bar($$) calls the bar() method quite visible passing $foo as its explicitly non-hidden first argument. The pipe call is clear and easily traces, the object call requires understanding OOP. I'll grant that OOP is much more common, and therefore generally understood by individuals who already know OOP (as tautologous as that statement is). -Sara