Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:115453 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 29636 invoked from network); 17 Jul 2021 14:23:48 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jul 2021 14:23:48 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 8895C1804D0 for ; Sat, 17 Jul 2021 07:48:17 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Sat, 17 Jul 2021 07:48:17 -0700 (PDT) Received: by mail-oi1-f170.google.com with SMTP id w127so14670150oig.12 for ; Sat, 17 Jul 2021 07:48:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5T13JMqoVe8ByH/lGe5Y3JTf63Iqzo90s6T5o1DQP1M=; b=ZJ/rQLTO6zyrJt/qtvO3BVtLr+SFinYB94sTMNgzTfThQi07bmu1my8+62m2866bPV B/ERQ/qCiuAtQkgX7OCXCCjtk6ioXru/UVeFrsn8h77g/YQnBYbgxNUdZ5FfXyV0/vMh +69WcZxuHllCAZf/QMLOhno8QTqT7k3reldzSiCPHy6ZROEluFG1aIYNKxuwQgz0KDne 49kfJXAbRkhOOXj+10gnh4Zu0L+OshdBmeNZmFXqIEMxdkiIQSKgs2Mt24O8ZABp+0ST uweLrCybJdVNhvdgZmSvSTO6JrPeg/A7C6nf3d7FenwuA/pw587vM7PrluxTfO9f/R0J 9G4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5T13JMqoVe8ByH/lGe5Y3JTf63Iqzo90s6T5o1DQP1M=; b=tPgOfIdXxjXUy3/njhKMRIWyoBBFk8GnRxzuXkpTexs4T7qQ8P8WGafVyM/Qg1BLxE d5Je7ooW7sM4AEj5OnfGL0NYZSwgX8ip7AET7+dKPaJ0n+l4hmxOrBQxeJbTDk1aMt9v lBNdbZ+oPwRqEIyUoZUnpVLl90k+AD5oqhYwgC6+z5ZgF5amdFDb43U/ru5PEPAmYLLT q2oqoTqDEcaPLvCNJw6Te4SB0jN2P4TiXGLpCUDKPwWt78/2lZY5+RgvIYLu1ouWhDL0 zMdSQXVBw++d1XIJziRcIthYmMEhCkqfwgyaykclhWpq/BBKWVqB1Xfx8FIHdVA3c6gi zcdg== X-Gm-Message-State: AOAM531Xz/WNPmaCtVx764hBohYTzJHdvbXLgz6fmc+CN6Dldxg4AjQO uuPCqjiYJiYKH3sTE59MMxCG0SS+rAkwqbIcAnU= X-Google-Smtp-Source: ABdhPJyOjQcF19jkElG+L4UrMVKi70rNg688gvNnOVIKdruD0czlLr2vUm6iweYmnG6NfkNypOz2C7Z8UUwJYj7I92I= X-Received: by 2002:aca:5dc6:: with SMTP id r189mr16499398oib.164.1626533295571; Sat, 17 Jul 2021 07:48:15 -0700 (PDT) MIME-Version: 1.0 References: <6a2ef792-9624-4355-ad08-dcc7bfa5e19f@www.fastmail.com> In-Reply-To: <6a2ef792-9624-4355-ad08-dcc7bfa5e19f@www.fastmail.com> Date: Sat, 17 Jul 2021 16:48:04 +0200 Message-ID: To: Larry Garfield Cc: php internals Content-Type: multipart/alternative; boundary="0000000000004c486c05c752cb8a" Subject: Re: [PHP-DEV] [Vote] Pipe operator v2 From: ocramius@gmail.com (Marco Pivetta) --0000000000004c486c05c752cb8a Content-Type: text/plain; charset="UTF-8" Hey Larry, I just voted "NO" on this: it took me a long time to decide, because I've been vouching for pipe-alike operators myself for a while. The reason why I voted "no" is that this is feasible with a `pipe(callable $first, callable ...$piped)` function, without having to add syntax/AST for it. Type safety for such a closure would still be very messy, but feasible with some macro-based templating of docblocks. The simplistic approach to this is simple composition (the `.` you mentioned): ```php /** * @template TIn of mixed * @template TOut of mixed * * @param callable(TIn): TIntermediate $first * @param callable(TIntermediate): TOut $piped * * @return callable(TIn): TOut * @return TOut */ function pipe(callable $first, callable $piped): callable { } ``` Pol Dellaiera (https://github.com/drupol) has done a lot of work around this stuff, specifically the type inference bit, in https://github.com/loophp/combinator , so I see hope to get better types at a later stage. Therefore: * userland runtime **implementation** is trivial * userland type-safe definition is non-trivial, but not insurmountable Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/ On Tue, Jul 6, 2021 at 7:13 PM Larry Garfield wrote: > I have opened the vote on the Pipe operator RFC: > > https://wiki.php.net/rfc/pipe-operator-v2 > > The vote will close on 20 July. > > -- > Larry Garfield > larry@garfieldtech.com > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: https://www.php.net/unsub.php > > --0000000000004c486c05c752cb8a--