Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129206 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 984C81A00BC for ; Wed, 12 Nov 2025 15:46:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1762962411; bh=XowIFN1CuZydyv0ZLidWst/dBU+fkNz6K1Eo1nRs4IQ=; h=Date:From:To:In-Reply-To:References:Subject:From; b=B9gi3UVtX9HUFatkIJlVK43965srrfRfK9dcbHJvqTeHZWPwnFY/oI/FtxyacBcRV n/tAbBsjrtR64+iimyfuQBve34eGst4MjAB+tt5cmn5zd1Ij+F0eUWQyjQzlYVW7kC 9NFx6R444IYGCGHaRqT1F9LSfzqKtHT2U1nu6uDs8u42sGV0WfmDPhvFqT18Y3S+F4 VDHYt7XfKBsvy5EPHTsVNXiDyOTJbPYL2CYdH8z8iKmr4gpEU5u8Evm/y5NxTC+Gfd fHGeNbbnzMWcWpmPMJOBDTpOMBg7J0hKd10JrBfC6BA8MxDicc72Jyb0FsB7qwYMXm DKPlwNJi/otFQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7BD41180041 for ; Wed, 12 Nov 2025 15:46:50 +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=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_MISSING,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a5-smtp.messagingengine.com (fhigh-a5-smtp.messagingengine.com [103.168.172.156]) (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 ; Wed, 12 Nov 2025 15:46:50 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id B333E14000EA for ; Wed, 12 Nov 2025 10:46:44 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Wed, 12 Nov 2025 10:46:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= garfieldtech.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to; s=fm3; t=1762962404; x=1763048804; bh=oiYkCXSXd4E+BTy/NuNTG xO2ln5bJ40xyOuCnzPA+2s=; b=RO3SBnnKGS9e9h9qUmLlTyODga9Honl3ZiHwi dPgJfQEXMhmao+xzd3kOrL0QkxA/jl9semu5XPdHaWw419jCNdPgCasbm2xgqYeQ ME06qp4Ibt05sJGqlX7bHWtsd+EMGakcNY5hRD2Mk5SOd8YDtoObwFADe15HsTGN Ymv4OEH7Wktq07+kSY+Sqs2vT6RcIARrF6tATrKiC81QVg1kzawEOxFFaxSBwHcz N2xW/EvPz3eouXMfzxColxTosIiQepJKcL9RxifxfStUb1X0T6Nf5MZCth2NJXva Z5R8SM/SPCBb0q6JZbKkQxWMMzHO6oghMA+wBfYHn9dcrKpbQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1762962404; x=1763048804; bh=o iYkCXSXd4E+BTy/NuNTGxO2ln5bJ40xyOuCnzPA+2s=; b=qczBRTxWhJG1s79zl 7Grezwzzm17YPVO04qJjnjFigUg7W2XyhVYpcUpb9xLIt209nwkVA9KRnHxTK0Kr kEO5YbA+pz5nS2JZs73Bp+VmEFQp34KhYV66Taff2f2rJlpEqWdrQixX0lNn9Sh1 fJeT3zzbvH/DXT+a09qR153aSiYi0bDWmGucRfvaGdak9ba3icsHijkAsiEyjp3e w7GT4UrxWKQux7A8iMdpuSy38Eep0o4dfSfo00lEyQx6TvTnvonp/djedwkbKmbH v36kCX98gtyTjmftGFM3yL4PGxPjJHLvL1qyeuW8ERbrEyJAlcL8u2YC+LDOFPPm 9FMfw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvtdeggeejucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeehjeefvefgfeduteffffdvheeiudekieefleevvdduiefg keehvdevheffvdegteenucffohhmrghinhepghhithhhuhgsrdgtohhmnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheplhgrrhhrhiesghgrrhhf ihgvlhguthgvtghhrdgtohhmpdhnsggprhgtphhtthhopedupdhmohguvgepshhmthhpoh huthdprhgtphhtthhopehinhhtvghrnhgrlhhssehlihhsthhsrdhphhhprdhnvght X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 4CB1D700054; Wed, 12 Nov 2025 10:46:44 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 X-ThreadId: ALvh3TDXSVwZ Date: Wed, 12 Nov 2025 09:46:23 -0600 To: "php internals" Message-ID: <4f8f00ce-d734-42a5-ac4d-da4f9ebf14f0@app.fastmail.com> In-Reply-To: <82532f65-c944-a854-170f-3b70ce1c552d@php.net> References: <566ce444-0cba-4a72-94e3-64f52b3cf93c@app.fastmail.com> <82532f65-c944-a854-170f-3b70ce1c552d@php.net> Subject: Re: [PHP-DEV] [RFC] Context Managers Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Tue, Nov 11, 2025, at 5:31 AM, Derick Rethans wrote: > 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 o= ut=20 > of loops (such as foreach) needs to be handled with care. I defer to Arnaud here. >> 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= /helpers.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. Yes, Laravel is in the wrong here, but AIUI even a namespaced function w= ould conflict with a soft-reserved keyword. And regardless, breaking La= ravel is not a great plan. >> 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 How about `using`? --Larry Garfield