Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:100791 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2457 invoked from network); 27 Sep 2017 19:56:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Sep 2017 19:56:13 -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.220.175 as permitted sender) X-PHP-List-Original-Sender: php@golemon.com X-Host-Fingerprint: 209.85.220.175 mail-qk0-f175.google.com Received: from [209.85.220.175] ([209.85.220.175:56171] helo=mail-qk0-f175.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 8A/57-34114-B520CC95 for ; Wed, 27 Sep 2017 15:56:11 -0400 Received: by mail-qk0-f175.google.com with SMTP id q8so14372511qkl.12 for ; Wed, 27 Sep 2017 12:56:11 -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:from:date:message-id :subject:to:cc; bh=B19n/gIK/cVp/Tjq+nVZdyZsWflYdh+lv6WaJbnd/nM=; b=ii1jKSTmZJHRhY+4PHPHJNYW+4TFul0xVGJrgUoEaL2r13h7fl/adRpVpSO9rgEf+6 WFZ6/cjYxTL+NkCTx0BMiUXF4py6wmZ5lEF0qThp94Ta5l/UCBYq1wZwqHDvAWTt0iw+ LMgH7VbIcuOuX8T8DW2YGnsAduYKv6Ku+/It7TJ/UDJLB0P3SBLBL2cuu1UttN1E8TL/ efiyvC2ldR9hpJ97ZdYGoBBMO8aGPTBz7HypsFiMJ4D07pCzvtARNlEk3d4DL7y2xnYa 4XlmJiHIXJif4pUUdgXv0NSZ6RBkQv9wEf0a/gmkbPmCH6fbxcvkTlCiYmAy5lyPUHzg OF3A== 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=B19n/gIK/cVp/Tjq+nVZdyZsWflYdh+lv6WaJbnd/nM=; b=R97NrxfqYpRo75Xq7uQH9xUOBUdFWhpydJxLmMNRRSAtQqAIQ2N9vthYwgb/WgaMD1 2Th1drV+MjAQ0Wnf67MgGGXYV3byZHaIQ6XW0ng8aHD2VVW1smFmKDF1HTr5/7okzkzH JwmwcWKb9yFkA1kZGIfewMbocfbZLK2ucE40eTiMdlX7rbOtuX1wefyv/JnYLKBK7D8w GDoiwP/DfEK4bRPBSr+DuM19FNRD0wmIXDHUZgfjCxq0hIfew96yabu7IL8ZsaDlV0um GpJStebaxw9oe9RgPr1cEhSiHaG+rtnWVCUJdoPM7ZF7lKMEcnHNlP9kOk3AvujoS8Ky 5a5g== X-Gm-Message-State: AHPjjUgasBzHqcRenTRuSX875GUNAX2XmRdgr4x4StwV6H+mJ/XCZTlr zIVuHcEeqkr56jbRPUyF2JXD3xVn4G3AagoEVdgxGg== X-Google-Smtp-Source: AOwi7QC8tfKC/XvAdBzsC+Xt6Ov1xOjhAf63Mhr1lyV0BHSLYUD1riFSHIxhf2AqYi4gSljOf2AVZP9/tmKIvcwjRZQ= X-Received: by 10.55.123.1 with SMTP id w1mr4031497qkc.114.1506542168767; Wed, 27 Sep 2017 12:56:08 -0700 (PDT) MIME-Version: 1.0 Sender: php@golemon.com Received: by 10.12.132.3 with HTTP; Wed, 27 Sep 2017 12:56:07 -0700 (PDT) X-Originating-IP: [206.252.215.26] In-Reply-To: <98e7fff2-72ac-0430-72bb-099a021626f6@gmail.com> References: <98e7fff2-72ac-0430-72bb-099a021626f6@gmail.com> Date: Wed, 27 Sep 2017 15:56:07 -0400 X-Google-Sender-Auth: aWgfKOCwMlYe3bZUaLQAH-0-2ME Message-ID: To: Stanislav Malyshev Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Pre-draft for PipeOp v2 From: pollita@php.net (Sara Golemon) On Thu, Sep 21, 2017 at 5:13 PM, Stanislav Malyshev wrote: > It'd be also nice then if we could have some syntax that allowed us to > refer to functions/methods as callables - mostly for the benefit of the > code readers and IDEs. I.e. you can do "hello" |> "strtoupper" and it's > fine but it is not at all intuitive what you're doing sending one string > into another. Same with "hello" |> [$this, 'bar']. Now, if we could do > something like this: > "hello" |> &{strtoupper} > "hello" |> &{$this->bar} > Super-hacky implementation (that I wouldn't want to merge, but it shows the syntax at work). https://github.com/php/php-src/compare/master...sgolemon:lambda which provides a form of both short-closures and partial functions. Combined with also-super-hacky pipe diff from earlier, you get: $x = "Hello" |> &{strtoupper($0)} |> &{ $0 . "world" } |> &{strrev($0)}; var_dump($x); // string(10) "dlrowOLLEH" -Sara