Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130677 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 lists.php.net (Postfix) with ESMTPS id 368671A00BC for ; Mon, 20 Apr 2026 20:09:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776715787; bh=L99etJT1AixbGdaGGrtRopgDzGFJkbfVS7IaloGWZsI=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From; b=UMl0vhkxYiLKpV0n8PzMN3O+kyqQaiEXMaTXoVTAS3i0KP2UBg6YJA3E8BjZ3RZ+6 4zbiqsN3vz7qnHOM5PlUoaQjnyMW1JSsghyaecQ/TOIqrnGQHsoEZnuMSJhu/if7m+ 5FPeE7POMFbsUX26hirFvGjANc945mmrIvzHPASGl8X7e2dRChoZTTEIobzsdrs5sK 0goVFts9rYo1+FBiMDa4dMoIaMge5lvt470bNMSYngYv+Z3MFQMSuh2kpz/HKpGL5G v5CNTB3LQXS5Xuc4AXPyV/tpPjTHbdszC7aFQQxu5X9UTsa9qkUA53/1m2dwhQSJCi 5unsyqKTxKgEw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 9D8CA180032 for ; Mon, 20 Apr 2026 20:09:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) 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.1 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 ; Mon, 20 Apr 2026 20:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1776715779; bh=k9Ef/qdndMHWh57D2JL5+MiyHnhf22QmrYT04L4+71Q=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type:from:to:cc:subject:message-id; b=WK1F6vg7AuNEOdovsY76L8ggUs9BpA4YkmPllok/ap0IiI9k05WOaPX/ca92X4KK6 fqFZ5l4IFwz55VVBNJaLcI5JugbqDBShAdHuitycPizkk+t68f4IaC67ElcVV3mdPG qwlCvv0jjqL/9ltyytCdlrEPoFAZES5IsXv4WsG3j13vEz0BDVtSqQQLawcv+6J7/z MzqkIsOSvNZqrliM44Hja3RSUVT9REIDKDfvmFviQ5HvdEV5FJh2YYf84CBGaOQ7qL iGjxZkzTEZFlflV4WTO/F/kS3tHEc1WI0pOvKIf8eGxOfhawFWrrL82893iKWtB+FW iSGp8uN1kgTNA== Message-ID: <6dddead1-cee2-43e6-b943-ca45823f30b9@bastelstu.be> Date: Mon, 20 Apr 2026 22:09:36 +0200 Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] [RFC] Context Managers To: Larry Garfield Cc: php internals References: <4985896b-c80a-4302-912e-9f572a260fb5@app.fastmail.com> Content-Language: en-US In-Reply-To: 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 2026-04-15 16:52, schrieb Larry Garfield: > The finally path is only reached in case of a successful exit. > Therefore there is no exception to pass in, and thus returning an > exception is meaningless. […] That's not at all how I understood the RFC text (and I admittedly didn't look at the desugaring): > If exitContext() returns a throwable (either a new one or the one it > was passed), it will be rethrown. I understood the “it” in “it will be rethrown” as “the returned Throwable is thrown”, not “the Throwable that was caught is thrown”. That is also what is mentioned in your email https://news-web.php.net/php.internals/130413: > or a throwable, which will then get thrown and > If there's a reason to wrap and rethrow the exception, do that and > return the new exception And that is what the second half of my email https://news-web.php.net/php.internals/130479 is based on, particularly the joke in the footnote. Why has this misunderstanding not been pointed out back then? ------------ So based on the desugaring that Rob thankfully looked at, of all the information in a `?\Throwable` return type, only a single bit is used - and only in some cases. I don't see how we can meaningfully explain to users that throwing away all the other information is the expected behavior. Best regards Tim Düsterhus