Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97891 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 23901 invoked from network); 20 Jan 2017 14:43:05 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jan 2017 14:43:05 -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.66 as permitted sender) X-PHP-List-Original-Sender: morrison.levi@gmail.com X-Host-Fingerprint: 209.85.215.66 mail-lf0-f66.google.com Received: from [209.85.215.66] ([209.85.215.66:36121] helo=mail-lf0-f66.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 92/B3-00729-9F122885 for ; Fri, 20 Jan 2017 09:43:05 -0500 Received: by mail-lf0-f66.google.com with SMTP id h65so8790183lfi.3 for ; Fri, 20 Jan 2017 06:43:05 -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; bh=izzCkXtwcIqMObAfz41j7rBUmKLE87iNTGMKiHDeuII=; b=UQOOB7HVGF1x7XC1OX+F0jxR4kyj2I23viWGEQ1R5nAnnOyqb6H4qDfaceg6pYE5w5 6noYeZOAcysiR/nzQ1p26rGAoJDt4CMXH8LLBK6vhI8xIUIWpcwVG1FoSGmNtfg+4tEY IBzxdEERwI8uSNgxQONiT7N80rEbVkr3cSpI9fJeouHslEzUrI4pnD0AmWvl5ggtcZZS RuY84cxE2P1fqBxsxl5W58ZcKzcOkPgcC0GVkDzr6xGp50Xgx8VRRYmv8F2fQB6Jf89M /+WVpCtgocYEH5u8YOLARVGIrvfNYBSIMIziQWX/2ZtM/r2PxHXLO2Riz/HAUwKZWi1c r+CA== 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; bh=izzCkXtwcIqMObAfz41j7rBUmKLE87iNTGMKiHDeuII=; b=R9g4fz7QMyAlsNg4NlLTqh31U4z1Lq+F84HFpjrtD7A7HficrAbElibdilVv5zmXWt mPf5OD8/HNTNIHlIYtBD78ploT6alW82eKAQoY/68b/R9qAb/cbPzB9kt6pPv9HWnVII MXx1mrRSDTC+tOZ9jQ4qgpz2/hjf2f9tnFuLOGrwY3077MSyM6fCQEaQXvDQP9Q9sANb aWX53r/4FZwIpO71P0kDE8cejItD2iGzvGR9HAS1L5okLkscXSLVejrrsmyEUWgZl+gb CKiccX/rH16efno/blSH0imoRmkCgrc3wuNQ9Rqry+xJGNGaNd0gZXQ+Rwn8Txa3jRbg lycg== X-Gm-Message-State: AIkVDXJVQV1rSJ1eb05yeb4zux0luNbM8yYLk3TItbR7yskLdNjcE1ClwfXIDn1L9qXRRMnlrOAV5f2qMTUL9g== X-Received: by 10.25.28.199 with SMTP id c190mr4993659lfc.173.1484923382358; Fri, 20 Jan 2017 06:43:02 -0800 (PST) MIME-Version: 1.0 Sender: morrison.levi@gmail.com Received: by 10.25.151.139 with HTTP; Fri, 20 Jan 2017 06:43:01 -0800 (PST) Received: by 10.25.151.139 with HTTP; Fri, 20 Jan 2017 06:43:01 -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 07:43:01 -0700 X-Google-Sender-Auth: YFXaMKB8QSTxWLJxK9hLWg6SGuA Message-ID: To: =?UTF-8?Q?Fran=C3=A7ois_Laupretre?= Cc: internals , Sara Golemon Content-Type: multipart/alternative; boundary=001a11402332b9698f054687aa56 Subject: Re: [PHP-DEV] Pipe Operator v2 From: levim@php.net (Levi Morrison) --001a11402332b9698f054687aa56 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On mobile, sorry for top posting. Multiple $$ means the resulting closure will accept multple arguments. I'm definitely against dropping the ($$) on the right hand side because it would use non standard symbol lookup rules. $x =3D trim; This normally will look up a constant, and then apply barewords if it doesn't exist. Let's not go down the road of special casing things. On Jan 20, 2017 3:53 AM, "Fran=C3=A7ois Laupretre" wro= te: > 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 > --001a11402332b9698f054687aa56--