Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126329 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id A6B1F1A00BC for ; Fri, 7 Feb 2025 13:32:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1738934974; bh=yvg40BWN50Ackm+doj64fe4GQ1F7no25cL+nJSAw+Qs=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Etaun3mRXjX0yZbzR4zvVr4gNd0pa0HCE4SMpwg+0ZLoxzE6mOVP1wAIUrFmIOD1g reWENDv1ClGMQynBiN3Jf/BalRVTuSO4i0N5WpnR+izQ4Rt61WNIKIK/RtiRctn6l1 L45oBEZuBZjec8Igv5f3bXFz5RXI+Ua2GtArmxeFiTGA/z6ptwx6Jg58d9XtxhRhZx gLbJF70ZB1013+0Qq5+T+2K6OctrUp8yLcx9yg2zm7Tla0IC6fYLcef5mQkAg7Zusx Rv+TsnE9i4/RhRMFUaVglUmDHoyTFKBXjwwWk4q+8TkNkuBQyEuK3fSNX0Sr1Hn3+V 9Yau6V9ImPAgw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 58F06180034 for ; Fri, 7 Feb 2025 13:29:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 7 Feb 2025 13:29:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1738935134; bh=Wurh1jZt0ydiDxvfKsEoxaVm0a8ntyccjQTjDPEPWpg=; h=MIME-Version:Date:From:To:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=KgNZAKh5c5nHhmiY2kbBM6v5RgHbnFjD660C5xCNOxD7tHtZ0Iy4JdaQTOD2ydBLN 062em3jN3L95GqSRVyf8kDoZQ+M1Op+QLI4z/nXgaDJg5JkHcoPReKVwVwKUupyZMV pNHuTgDRz3Z+RAOtCSMZvk+UbiUBaT//6v9EuaQy610rLFSmDgl2MXRiTbCry4K7YG elZ/V9jOAzl9GzKT0hBp2wLnRLsfNAKATzqrMSh/10zZ5T1zsoC5xXgNeruUTIuA3Y O8VE11l1CUDgnLmGpeB+aJPZ9VOff1Pm+xABICXafLpnbgx4YAyGin1TDOsaCUHxv2 TQi92kX+Pgmdg== Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Date: Fri, 07 Feb 2025 14:32:14 +0100 To: internals@lists.php.net Subject: Re: [PHP-DEV] [RFC] Pipe Operator (again) In-Reply-To: References: Message-ID: <5a584219f120385e7e30f6d0a46cc108@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi Am 2025-02-07 05:57, schrieb Larry Garfield: > It is now back with a better implementation (many thanks to Ilija for > his help and guidance in that), and it's nowhere close to freeze, so > here we go again: > > https://wiki.php.net/rfc/pipe-operator-v3 There's some editorial issues: 1. Status: Draft needs to be updated. 2. The RFC needs to be added to the overview page. 3. List formatting issues in “Future Scope” and “Patches and Tests”. Would also help having a closed voting widget in the “Proposed Voting Choices” section to be crystal clear on what is being voted on (see below the next quote). --------- Regarding the contents: 4. “That is, the following two code fragments are also exactly equivalent:”. I do not believe this is true (specifically referring to the “exactly” word in there), since the second code fragment does not have the short closures, which likely results in an observable behavioral difference when throwing Exceptions (in the stack trace) and also for debuggers. Or is the implementation able to elide the the extra closure? (Of course there's also the difference between the temporary variable existing, with would be observable for `get_defined_vars()` and possibly destructors / object lifetimes). 5. The “References” (as in reference variables) section would do well with an example of what doesn't work. 6. In the “Compose” section: The section always uses the word “callables”, but doesn't explain how it resolves the ambiguity of `[Foo::class, 'bar'] + [Bar::class, 'foo']`. Should it read “Closures” instead of “callables”? 7. In the “Compose” section: It would be useful to explicitly spell out in which order the individual callables are called. Will `(strrev(...) + ucfirst(...))("foo")` result in `ooF` or will it result in `Oof`? 8. In the “Compose” section: The RFC says that “ComposedClosure” is not quite equivalent, but it doesn't go into detail what is not quite equivalent. Specifically: Is the result actually limited to a single argument? Using the `ooF` evaluation order, `(strlen(...) + str_replace(...))("o", "", "foo")` could reasonably result in `1`. 9. In the “Why in the engine?” section: The RFC makes a claim about performance. Do you have any numbers? > Of particular note, since the last RFC I have concluded that a compose > operator is a necessary complement to a pipe operator. The RFC lists “Compose” as part of the “Proposal” section, but also the “Future Scope”. Should the part in “Proposal” be removed? > However, it's also going to be notably more work, and the two operators > don't actually interact at all at the code level, so since people keep > saying "Small RFCs!", here's a small RFC. :-) I like this. Best regards Tim Düsterhus