Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129195 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 4962C1A00BC for ; Tue, 11 Nov 2025 11:31:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762860682; bh=Cunqvt/GLiQqoTKI3pplYQVDb02n/JW0nu04W+vKP6E=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=OqCSpidFE6STsQBMNnJctgjHCIkky2CS70SnY8Xw4Eb09YS3Hf5NKgqQquLS3V4Ma HHH/ZUp5TFGSmRQ+Xxxml+IMZrPzgw1HImXeMguXOA6krVePUetd9gl0hmGCIFvHYm zid1UyX0Kw2mP0kW+Cmvh08VTSleInChblnTko+l/2nI07u+aPPqwokZ9rFPd/wmrO xI95X3cP4eqE14Y6apCZCPmH+7ene6kqsa/6AXHlDMl2WxKqvqnllYSdCVYVICWRgx XDp39b0UfBrpKBHL5Y8t8/s3xZumPlg+ilMSN2siuBwp2GhrJqnQO2zjl0Kispt24T ncHXeTkKpZdOg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 5210C180062 for ; Tue, 11 Nov 2025 11:31:22 +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=3.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_PASS, SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) (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 ; Tue, 11 Nov 2025 11:31:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762860675; bh=Cunqvt/GLiQqoTKI3pplYQVDb02n/JW0nu04W+vKP6E=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=cDYld/3j+zUXvOtfFPxLOT8F3Pg6pncq9aPG9zoBXYO45YuGPFHOrdq6XYqaoVTQd s+tejjytrsXQknT+2JiKefeOBDa2cMG6IlSfAybm014nndYLCNpYZNwZDImd6EGjKo 58NQ5ajD9IRbi7DKFyFV0R8MIAtZpDZ+HzlP6GGQk7cvZc6qslJ29TOpHQW92P7FOq 6Wz7HMXClcHZ0+Gr8Yvl8+VG4BAssrSN6P++9v9jLUdZgFIaCTvtn+7asXMo1UQz9H iva+p4369VHkB4MqFwTyfLZj9sIziqXnewYHrMMxxuTVppvE157immV9CmYBq6SRIm kJnp1obTWBW3w== Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 8F7F710C46A; Tue, 11 Nov 2025 11:31:15 +0000 (GMT) Date: Tue, 11 Nov 2025 11:31:15 +0000 (GMT) To: Larry Garfield cc: php internals Subject: Re: [PHP-DEV] [RFC] Context Managers In-Reply-To: <566ce444-0cba-4a72-94e3-64f52b3cf93c@app.fastmail.com> Message-ID: <82532f65-c944-a854-170f-3b70ce1c552d@php.net> References: <566ce444-0cba-4a72-94e3-64f52b3cf93c@app.fastmail.com> Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="8323329-1658006828-1762860675=:3802" From: derick@php.net (Derick Rethans) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323329-1658006828-1762860675=:3802 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE On Wed, 5 Nov 2025, Larry Garfield wrote: > On Wed, Nov 5, 2025, at 1:38 AM, Deleu wrote: >=20 > > Out of curiosity, what happens if GOTO is used inside a context=20 > > block to jump away from it? >=20 > That would be a success case, just like break or return. Basically=20 > anything other than an exception is a success case. (That said,=20 > please don't use Goto. :-) ) I do think you might need special attention to this case, as jumping out=20 of loops (such as foreach) needs to be handled with care. > And now the big one... also in off-list discussion, Seifeddine noted=20 > that Laravel already defines a global function named `with`:=20 > https://github.com/laravel/framework/blob/12.x/src/Illuminate/Support/hel= pers.php#L510 >=20 > And since this RFC would require `with` to be a semi-reserved keyword=20 > at the parser/token level, that creates a conflict. (This would be=20 > true even if it was namespaced, although Laravel is definitely Doing=20 > It Wrong(tm) by using an unnamespaced function.) Rendering all=20 > Laravel deployments incompatible with PHP 8.6 until it makes a=20 > breaking API change would be... not good for the ecosystem. PHP owns the top level namespace. That's been the going for as long as I=20 can remember. It was unwise for Laravel to flaunt that rule. > 1. Java uses a parenthetical block on `try` for similar functionality=20 > (though without a separate context manager). That would look like: >=20 > try (new Foo() as $foo) { > // ... > } > // catch and finally become optional if there is a context. =E2=80=A6 > 2. Either `use` or `using`. The semantics here would be identical to=20 > the current `with` proposal. IMO, the try syntax is more confusing than another overload of use. cheers, Derick --8323329-1658006828-1762860675=:3802--