Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:130640 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 7FB0C1A00BC for ; Wed, 15 Apr 2026 15:11:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1776265868; bh=TgE5A5mZxSh3e421wrVbyMqT6dp/0FFSsdokHcBc6h4=; h=Date:From:To:In-Reply-To:References:Subject:From; b=G8mW13WNqIpAldIX2nkMdLXcZwfYMsjst1rqcd9nx7AHdf+/CvKez65CNXhKo+ddr WPZ2WMccymj2ceqqaYcx5wIzCXnsB8sv1ZBbtDCLwfCU6Mdqwp0S1ScUv6MEvN5Yf6 yvlVFLnlUbmG2zv6Ml2MqL0pqn4yI7f0kXXpIgY5l6i12YNosICxBoF5gDzq2TKqw1 wJ6jwfe0WO5ZAQautTMn0UPZ+2qGl5+yTUyIgJxTlNwsTgN3jl8qElf1ISjpDiOK2e Xv/qAO6/05tFdOOfC2GPsomvVrnfcGyOxbnf4Re6vbh7e5IGhBE7QX951vXDDnLU+e QOjuAPSCgvTLw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 66BCF1801DF for ; Wed, 15 Apr 2026 15:11:07 +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.1 required=5.0 tests=BAYES_50,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 fout-b7-smtp.messagingengine.com (fout-b7-smtp.messagingengine.com [202.12.124.150]) (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, 15 Apr 2026 15:11:07 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfout.stl.internal (Postfix) with ESMTP id B76E11D001E9 for ; Wed, 15 Apr 2026 11:11:01 -0400 (EDT) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Wed, 15 Apr 2026 11:11:01 -0400 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=fm2; t=1776265861; x=1776352261; bh=1+rLm3sO4LQanpI1I0wCX iLJonvheFZq8tRywDIeXII=; b=MjMj2U0a3JgcFCqTCWkDgq5sg83+QGEaWtKh/ B7Z1EM+B9uypmSvyS+lL/7ngNaEwvZcZK0LnIJTEKQpqjUpbBX3jkFPYl1em4BH1 tC6I1F+3AskUOj/8NfdyAehcsr9w4J07HebcUMfqKohdhr1a8brVi1VbPyGBI7mH 7jH+PFQZ4Fb7f6HdgRnN8VZokWoxdQM5VIm7SG0wausO1mAT6DtSoe4cndEzg54z SNlCroHEyo3TVtMK21fLY+3I+J+78EH/4TwCLU4WOYKz3Ep2kkgFDDbSd5GQgoHG X0gC2Adav3n4HYz7u+SmUS9ZLKgeepS5N17sMcT5KymFxNuWQ== 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=fm2; t=1776265861; x=1776352261; bh=1 +rLm3sO4LQanpI1I0wCXiLJonvheFZq8tRywDIeXII=; b=M4XnYWnUQYviKEprc SE4DWhbtRtCBZXdlJNIxtNW0rLQ5zIqaCDMroWhOa3WvfVB1zifUjWIh31zdvxzP k4v9y5G3EnbhRfJrOWylhs9qJ+56c5/l6CkAbpVOqD4jaqfMWcTQKXMGdsnAXCy4 iiKQG1yk26FR2GwHcNeL7IGv4tjuwVJlyBGzCI3ikb8MQP0pM4QcMLcGVTxVe+zy sN+iusybSOxwD+KHEAFGhUU7bGG7kmiAwl7NeYdcGOOUPM14y9jKWBt9jDFSnHVa IgfYBsuVD09Eqq6cl0xC9aPDz9/WBgJlzCBbPqfdeSb9bhqu6kbFIJNNID93iEJe ZD20A== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdeggeegvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjug hrpefoggffhffvkfgjfhfutgfgsehtqhertdertdejnecuhfhrohhmpedfnfgrrhhrhicu ifgrrhhfihgvlhgufdcuoehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomheqne cuggftrfgrthhtvghrnhepheeiffduudelffejhfetteevkeejveeludfhveetffdvkeev jeekveeltedugeffnecuffhomhgrihhnpehphhhprdhnvghtpdgvgihtvghrnhgrlhhsrd hiohenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehl rghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdr phhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 38712700065; Wed, 15 Apr 2026 11:11:01 -0400 (EDT) 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: Atmh9k-BTBuN Date: Wed, 15 Apr 2026 10:10:40 -0500 To: "php internals" Message-ID: In-Reply-To: <7991abf6-9cc8-444e-885c-4f8cd6078fa8@gmail.com> References: <5d96fca3ca5418e6e9e5d8871b26477f@bastelstu.be> <7991abf6-9cc8-444e-885c-4f8cd6078fa8@gmail.com> 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, Apr 14, 2026, at 3:42 PM, Alex Rock wrote: > Le 29/03/2026 =C3=A0 13:14, Tim D=C3=BCsterhus a =C3=A9crit : >> // ...=20 > > > I'm sorry that I'm arriving super late in the process, but I've=20 > subscribed to the mailing list only recently. > > To give here my 2cents: > > I think this RFC addresses something good (scoped code in the middle o= f=20 > a bigger chunk of code), but does it maybe a bit too bloated-ly. Hi Alex. I think you're missing the point of this construct. What you're describ= ing is much closer to the recently-declined `let` scoping keyword (https= ://wiki.php.net/rfc/optin_block_scoping). The entire point of context managers is to abstract away and make reusab= le the try-catch-finally logic. That logic needs to live somewhere so t= hat it can be reused. That is what the ContextManager object is for. I= t's not a complication; it's the entire purpose of the RFC. Since you just recently joined the list you would have missed the earlie= r discussion in this thread of closures. (See https://externals.io/mess= age/129077). In short, closures are what people use today for this use = case, but they're a PITA because they don't support auto-capture (unless= you're using the single-line version). That makes them less common, be= cause they're a pain to use in this case. In addition, they do create a= new scope, which... is not what we want in this case. Not creating a n= ew scope is a feature, not a bug. =20 Also, this email serves as notice that I've updated the RFC again to mak= e continue an alias of break, as it was originally. --Larry Garfield