Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93370 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95503 invoked from network); 17 May 2016 12:16:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2016 12:16:05 -0000 Authentication-Results: pb1.pair.com smtp.mail=francois@php.net; spf=unknown; sender-id=unknown Authentication-Results: pb1.pair.com header.from=francois@php.net; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 212.27.42.2 as permitted sender) X-PHP-List-Original-Sender: francois@php.net X-Host-Fingerprint: 212.27.42.2 smtp2-g21.free.fr Received: from [212.27.42.2] ([212.27.42.2:15151] helo=smtp2-g21.free.fr) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FA/01-19201-48B0B375 for ; Tue, 17 May 2016 08:16:04 -0400 Received: from [127.0.0.1] (unknown [82.240.16.115]) (Authenticated sender: flaupretre@free.fr) by smtp2-g21.free.fr (Postfix) with ESMTPSA id B2AD6200220; Tue, 17 May 2016 12:06:30 +0200 (CEST) To: Sara Golemon References: <98.61.11104.A1D41375@pb1.pair.com> <7c94ca37-e188-dd2b-a66f-bb63bf03041a@gmail.com> <1463008795.1856219.605250569.74618FC4@webmail.messagingengine.com> <92E7F8A8-0845-48A7-91B1-9554C5F66C9D@zend.com> <879feadf-c04e-c0de-826b-110b3eb4e22f@php.net> <85ec320c-b8d6-1cc8-2059-7b8dfa6589e2@php.net> <5739237C.1090605@garfieldtech.com> <33119a72-a146-ea6a-076a-67a886ebdaea@php.net> Cc: PHP internals Message-ID: <0d264480-3e55-4765-d6db-eec8dfcb47bf@php.net> Date: Tue, 17 May 2016 14:15:55 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Antivirus: avast! (VPS 160517-2, 17/05/2016), Outbound message X-Antivirus-Status: Clean Subject: Re: [PHP-DEV] [RFC] Pipe Operator From: francois@php.net (=?UTF-8?Q?Fran=c3=a7ois_Laupretre?=) Le 16/05/2016 à 19:53, Sara Golemon a écrit : > I think you're making a false equivalence here. One can see argument > ordering consistency as a serious problem without seeing a Heath > Robinson version of call chaining as the solution to it. > > I appreciate that you want to seize onto any opportunity to fix the > argument ordering consistency problem, but I don't agree that this is > the fix for it. I don't 'seize any opportunity' here. I just think that PHP would do a great step forward if people could write : $res = explode(' ', str_replace($from,$to,trim($input))); as : $input |> trim() |> str_replace($from,$to) |> explode() Eliminating the $$ is a natural complement to your RFC, IMO. It's not something tricky or artificial I would add to an unrelated mechanism. > >> The question of function aliases is not so serious because we'll need very >> few. Almost every functions have only one 'natural' argument to substitute >> as lhs. I'm not sure I understand what you mean with 'but only in certain >> situations'. >> > If it were so natural, wouldn't the original version of these > functions have been made "right" in the first place? I fear that the > only thing we'd gain by adding all these aliases is more functions, > but without the benefit of any improvement in the argument ordering > problem because now, instead of remembering which order the argument > is in, users have to remember which alias to call. Right. That's why I propose we start without creating any function alias. We're not supposed to allow writing anything in a pipeline. For every functions, the substituted argument will always be the haystack|subject|source|input argument. That's easy to remember. Regards François