Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129760 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 63DDA1A00BC for ; Thu, 15 Jan 2026 16:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1768492956; bh=it1WiYk90+G8CPpW0whpIEsVvLoR6fd2u5+S26H+Aic=; h=Date:From:To:In-Reply-To:References:Subject:From; b=YprxmsYR3hDZkStg7Vv1BlzTqc4mu9+bXHn9bbjAP3RVlc2OzbJwFhS1KtdKoyJgZ zfSNJR+joI/N5LuYdeklPf7L9rtYYqoZYFjxWo2tq0ugWcvYzY8Ra5ogXfbSEl4BAI OU434c+zjutAMQ6+K3jrgqQJ4XoeVkDwmwpG6oCqW73mkX+OcLq+PAZR6O5s9xPg21 0Qcsqws7L7oelmxnTvgvIGyCru8xIqU7mJYOQGwh7dYBrkp2VjFf6lYR9YVGHqzGZZ TjlqACyimeH7PEfdD+K1/ANphzl85REzQWymxnpDJGtOie9sOtcPrXI40hJ5+Ssr69 ulANAhOYJEPAQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 212861804D2 for ; Thu, 15 Jan 2026 16:02:35 +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 fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 ; Thu, 15 Jan 2026 16:02:34 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 68B121400155 for ; Thu, 15 Jan 2026 11:02:29 -0500 (EST) Received: from phl-imap-02 ([10.202.2.81]) by phl-compute-04.internal (MEProxy); Thu, 15 Jan 2026 11:02:29 -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=fm2; t=1768492949; x=1768579349; bh=SqY/gN45dXSPB8E22f6Fb rrhwlUPmrwZCfbUbTqmVaU=; b=snY+TjSboN8IoUH5IRtIDofBUBpYhCIAVJoFZ k/XmYZ4zPNi6KEaRPvcFrRlYXvVf8xBGcYi4sRI90lztUDT8AtMTdsmxNHjwVCLO xWKXfLg5yC57cabgwVgWyQqwLedT4OlYGB8uXGy0UPG3GOoR4qeX9rxrxeGUNIeR xdnZVYii+sKEYQnqYofrJQ5QOL+N8/2GaZ7BnSJwZ+ViAgaVIXxte8d3t3Z1caeo Qfgrl+mySqcDg9iMnlv8oYti+RLrgWSds0KQrDz1WOd5B7ZoITJiKJG7HdGc9Qj2 Rh6LgJI8PGEgHr2u2EoKxz4kX7ck+EyfDsB2SyXrRmrW+smnw== 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=1768492949; x=1768579349; bh=S qY/gN45dXSPB8E22f6FbrrhwlUPmrwZCfbUbTqmVaU=; b=oB+R2L5BM1EiPvwbB mx96kWrqJzMoZeSvOFDywnk/ea1fscNPOIYKmuO2X66mY8T9jyO186e7sYKcswGi +XCfaMmzvNENIaTVc5l6fWMpg9KSmvVT62NxfKlANDcNEU+vVtDckn4QkGfNF1oO hQEj+nFz+1dx51ksE6nqrEFzdGVsCehL6TW9qsba3SsIS/gqOXi1Un/TX0ARHKTj 3vhGDO88gyt3RYStwiRjXDWs4tVxYPhrZ6CdMxpA6kPQuPyziN7XNVL0T1nvkw90 ypsx1D+KBz99skNHgKT6nYD9syBHMWqRJ/0mDxzzovtpUkgRZ8Rgl//KZsz8+kyT PSp8Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdduvdeigeelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhepofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhih ucfirghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqe enucggtffrrghtthgvrhhnpeeugfetieejueevffdulefhhfethfekvedtueevgfffvdef iedvtefgheevteelffenucffohhmrghinhepphhhphdrnhgvthenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehlrghrrhihsehgrghrfhhivghl ughtvggthhdrtghomhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpd hrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 01B0070006A; Thu, 15 Jan 2026 11:02:29 -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: Thu, 15 Jan 2026 10:01:50 -0600 To: "php internals" Message-ID: <8cd697c3-5e25-4854-810c-da220da3f6d8@app.fastmail.com> In-Reply-To: References: <905d9879-70ef-4c87-8578-26519c6d4818@app.fastmail.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 Thu, Jan 15, 2026, at 9:52 AM, Tim D=C3=BCsterhus wrote: > Hi > > Note: I've not been able to fully work through the ML discussion and=20 > meaningfully think about all the commentary. This includes some of the=20 > older emails. I have also not yet given the RFC an in-depth read, like= I=20 > would have normally done. > > Some (incomplete) notes for now: > > Am 2026-01-13 23:19, schrieb Larry Garfield: >> Once those issues are addressed, I think we're nearly able to take CM= s=20 >> to a vote. (If anyone else wants to weigh in on some other part as=20 >> well, even if it's just a voice of support/approval, now is the time.) > > Something that I had noted in response to Rowan in the (what you call)=20 > =E2=80=9CBonus Thread=E2=80=9D in https://news-web.php.net/php.interna= ls/129582 and also=20 > in this RFC's discussion in=20 > https://news-web.php.net/php.internals/129618 and what was also=20 > mentioned by Marco Deleu in=20 > https://news-web.php.net/php.internals/129083 and what I feel is neith= er=20 > properly justified within the RFC text and as far as I can tell was no= t=20 > really discussed either: > > The fact that `break;` and `continue;` target `using()` blocks. To me = it=20 > violates the principle of least surprise that > > foreach ($users as $user) { > using (new SuppressErrors()) { > if ($user->isAdmin()) { > $firstAdmin =3D $user; > break; > } > } > } > > is incorrect code. The RFC just states *that* this will happen as a=20 > fact, but does not attempt to explain *why* that decision was made and=20 > neither are there any examples showcasing how that could be useful. The core point here is that we needed some way to successfully terminate= the block early, and `return` was already taken by the function. `brea= k` seemed like the obvious keyword to use, as in other contexts it also = means "skip to the end of this block." =20 `continue` is really just to mirror what switch does with it. If the co= nsensus is to simply disallow `continue` entirely (which is inconsistent= with what switch does today), we're OK with that. I don't feel strongl= y either way, so we're looking for a consensus. If there's a different keyword than `break` you think would make more se= nse here, please do suggest it and provide an argument. But "break does= the same thing here it does in switch, foreach, and while" seems like a= pretty straightforward approach. > I'd also like to note that there's also an =E2=80=9COpen Issue=E2=80=9D= listed in the=20 > RFC that is related to this topic. > > --------------- > > With regard to the desugaring listed at the top: Can you please also=20 > provide the desugaring for the case where no context variable is=20 > specified for completeness? Desugaring at the top? The desugaring is explained about a third of the= way down. :-) Is that what you mean? (In the "Implementation" section= .) It doesn't make any sense to go into that level of detail in the int= roduction. --Larry Garfield