Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97892 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27179 invoked from network); 20 Jan 2017 15:24:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2017 15:24:29 -0000 Authentication-Results: pb1.pair.com header.from=morrison.levi@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=morrison.levi@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.215.68 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.68 mail-lf0-f68.google.com Received: from [209.85.215.68] ([209.85.215.68:33779] helo=mail-lf0-f68.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 49/24-00729-DAB22885 for ; Fri, 20 Jan 2017 10:24:29 -0500 Received: by mail-lf0-f68.google.com with SMTP id x1so8958518lff.0 for ; Fri, 20 Jan 2017 07:24:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-transfer-encoding; bh=9kWrUVUcklu+CIeQjuI6SmRX6vr06tmr7geCB8T8+Lk=; b=bndw5WhM0eGXxj7uElgvSKdzOadEbEjmXZ0rWq2vGjsMms8cVswB96rWXU553xGwlY dLTK/NMr0ZIhRnvfzP3+FwqRaVO+pEPfxylgZOBnB7kopT06VJQf/oJcjlsCDBolSbOj PvSJwMCVrNdjVlk24jdXkXJ89v8/UAu7KgTA2noNho8S6OoAY8jQgSpdljQDNBqh2Uk3 nIC5uRvIE2BMf9FEiQeEXK7Vw69+v4ENu59zd4Vp5LtmZBAcCFBc6/kYc5Cnewp/0C8D BGrUV9MwyD35J6djzUhazxABDB1CLcvnrhgR/mqYeHFmOhfpwhpND2xJkJjcqVpw6ccI yKyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc:content-transfer-encoding; bh=9kWrUVUcklu+CIeQjuI6SmRX6vr06tmr7geCB8T8+Lk=; b=X97VmEU7HuKxbwqOAghntyUVYMphs1Xr7+kHbT8TFQmbVoxF6O3bBPaa/g0w3ZqMrW A4zZZR8cpDkdcmCElBGzOqgZ19N4zUOSmWCNp6DwGzuAdCRP8MTJTnMoOZwPH7bM95Ss jO7/U7MfV48ZDYmzOnmEqm3FxTlA9oAdaShxNcVg8yFCkUsoCs7bwBu3I6BaPt7qdOGX jyNYsf57qtO8YuHh5AT6Tzo2l1Gfd1K2Xk2SCMqEsMU20zNd0XEGfEayKa1kvvJUXT8A /aBBMveNegvGI26KVcQqsR5oNaXFTiMTkHKwQ131h0r860oqYikilVIL1gwgojK8Pnsl HVRw== X-Gm-Message-State: AIkVDXKgvCc3nYIFEeqBdIZYj8U1KVKNOXtHegCG19QtJlHOamAXQ1adq8vfDXWXXNsVI3bDdX6goEIh0R61Ow== X-Received: by 10.25.16.28 with SMTP id f28mr5409925lfi.89.1484925865922; Fri, 20 Jan 2017 07:24:25 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Fri, 20 Jan 2017 07:24:24 -0800 (PST) In-Reply-To: <52a7238f-af22-8960-c829-b1d4ba1bbfdc@free.fr> References: <52a7238f-af22-8960-c829-b1d4ba1bbfdc@free.fr> Date: Fri, 20 Jan 2017 08:24:24 -0700 X-Google-Sender-Auth: 7r4JsBfXdp1OAloXEJKs1hQkwQI Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: Sara Golemon , PHP internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Pipe Operator v2 From: levim@php.net (Levi Morrison) On Fri, Jan 20, 2017 at 3:53 AM, Fran=C3=A7ois Laupretre wrote: > Le 19/01/2017 =C3=A0 22:53, Levi Morrison a =C3=A9crit : >> >> On Thu, Jan 19, 2017 at 11:12 AM, Fran=C3=A7ois Laupretre >> wrote: >>> >>> Le 19/01/2017 =C3=A0 13:54, Levi Morrison a =C3=A9crit : >>>> >>>> The `|>` symbol would be the piping operator with these semantics: >>>> 1. Evaluate the left-hand side. >>>> 2. Evaluate the right-hand side. Assert that the result is >>>> callable. >>>> 3. Pass the result from 1. as the single argument to 2. >>> >>> >>> May I suggest extending your 3rd rule to : when the right hand side has >>> the >>> form of a function call, insert the result from 1. as first argument of >>> 2. >>> This way, right hand side may specify additional arguments >> >> If we only had `|>` this may be good but since we are also proposing >> `$$` then this renders your suggestion unnecessary: >> >> $string |> trim($$) >> >> Would work just fine with no performance overhead. >> >> Additionally, you could write: >> >> $input |> array_map($fn, $$) >> >> Or: >> >> $input |> array_filter($$, $fn) >> >> Basically, `$$` gives the flexibility of passing additional arguments >> and keeps `|>` simple. No need for additional rules for `|>`. > > > Right, I just suggest to make the '$$' optional when used as first arg of= a > rhs call. Except complex cases like array_xx() functions which will > generally require an explicit '$$', most cases will feature a '$$' as fir= st > arg of a function call. This may be considered as better because more > explicit, but I think the case is prominent enough to justify this > 'shortcut'. > > Another question: Will you accept several occurences of '$$' in a RHS ? > > Last, a cosmetic suggestion : replace '$$' with '$<' (more explicit as > 'input data', imo). > > Regards > > Fran=C3=A7ois