Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129466 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 7ADE41A00BC for ; Thu, 27 Nov 2025 14:43:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764254636; bh=SkdP7+6YtWTauGrTRrcgYvyglzQC4CEBYSIjcu/iEqc=; h=Date:From:To:Subject:In-Reply-To:References:From; b=fTfiBgHXl4z3V/5Bgyk5YD3CZkl/GY2x6SO1hOIFukdw3bLvGa1gZ+j4doQXLKxmP bbS1ih9VwlS4/GUsfLpUG27W4EhTfuBJ8+JlR19Db2Tv7oey2rwGStDbRu7R0YpnVP ZL0DFQQMOqjOqgSkSSE0hkhJOlmn9+pnBJNTLFMetj9YHc736gSYux3t4ST1sI7q32 E4gwnmm/CUwkgnKlhTf0mk/qfuiBl3mvJNRPSiumT6Upr3PIokWP73aUyYYMWitXyA AII3ZLtdUBFh+oJf4tRl1rx2nHYIa8YhCdC7QkhARKCC/7J+LMedHZB+dR55UjapOO mcz7Zoo/ZH5Jw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 32E0918002E for ; Thu, 27 Nov 2025 14:43:55 +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_PASS 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 ; Thu, 27 Nov 2025 14:43:54 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfout.stl.internal (Postfix) with ESMTP id 1526B1D00143 for ; Thu, 27 Nov 2025 09:43:49 -0500 (EST) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Thu, 27 Nov 2025 09:43:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rwec.co.uk; 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=fm1; t=1764254628; x=1764341028; bh=SkdP7+6YtWTauGrTRrcgYvyglzQC4CEBYSIjcu/iEqc=; b= heT5YRbRzXd681dDcbEFOsMyBvR6QCJ9zIkfg+hOhExwHLPS4A2FCGqvGEwg8y5c Z0UHPnaInkJ+H1qKIhiUcj6xRKtr2Noj/9P63bsC6eWVUn53D6y100NOKL2x4dyZ 8RoH8LeBu7IdRuvZUItcaEK5U7D9OvMMYjhfGo2MvupH3uVtrg923XMIgEptNW8P dC8cg/yD9eeJPptHbZNzsyUy5FiBm/+SiyH02qcIXkpRBEld/pp+yrxu9GKhxIV2 HLibLoBa4xEODMlAzPqsNv++N8vgXmRem9OlaVRHeLgTkOaNN+aeyfopDotmGEuU fxAv1qBBXkF6NR70PGwmVg== 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=fm1; t=1764254628; x=1764341028; bh=S kdP7+6YtWTauGrTRrcgYvyglzQC4CEBYSIjcu/iEqc=; b=PNZetSFQvh3UHLzcv iUXs8ncAJjkiENoaaGhKL/PzC4IP8haUwFgingW5qfk7aXxgrb9rWLd5oqirLebm XukG8iubGMKTQlQ0D8kduLHk1OO1zvNFQtX2WZAPSCcj7cedakVKpZ4ANfz07Qy0 WO3HxL0cQSzNc3qk+clpMbCwl7XY2HKznbaeOGUAr8btwGXJlJpNTuRH+akndhB2 oId44myY3i5U5Galy+CJtdHS2BfW/NyUNKyyq2dvUAAbCQLsnimUCTXX2Kpdvqz+ 6F2wnEvgMSblygLfK9Fcn9Z9Q63Cc6pnTU2IvFU8/KRPxP5AD443BdfSKd4MX0Tq HHSdQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeffedrtdeggddvgeejhedtucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucenucfjughrpeffhffvufgfjghfkfggtgfgsehtqhhmtd dtreejnecuhfhrohhmpedftfhofigrnhcuvfhomhhmihhnshculgfkoffuohfrngdfuceo ihhmshhophdrphhhphesrhifvggtrdgtohdruhhkqeenucggtffrrghtthgvrhhnpeehle ffteeigfevudetfedugedtudevledugeeugeelheeihfehgfdtkeevvefgleenucevlhhu shhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehimhhsohhprdhphh hpsehrfigvtgdrtghordhukhdpnhgspghrtghpthhtohepuddpmhhouggvpehsmhhtphho uhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslhhishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Thu, 27 Nov 2025 09:43:47 -0500 (EST) Date: Thu, 27 Nov 2025 14:43:45 +0000 To: internals@lists.php.net Subject: =?US-ASCII?Q?Re=3A_=5BPHP-DEV=5D_Examples_comparing_Bl?= =?US-ASCII?Q?ock_Scoped_RAII_and_Context_Managers?= User-Agent: K-9 Mail for Android In-Reply-To: <6ca9d7e54c291d1ce8fd74b5d1977034@bastelstu.be> References: <26a2f13c-f318-4d6c-9595-bfaaebcbabcb@rwec.co.uk> <432ca4ad-7bcc-43bd-8e05-3121839b4ff7@app.fastmail.com> <6ca9d7e54c291d1ce8fd74b5d1977034@bastelstu.be> Message-ID: Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: imsop.php@rwec.co.uk ("Rowan Tommins [IMSoP]") On 27 November 2025 09:08:14 GMT, "Tim D=C3=BCsterhus" = wrote: >For me the relevant keyword that indicates that the value is not used dir= ectly is not the 'as', but the 'each' part of the 'foreach'=2E Just by read= ing it as a English sentence, it becomes clear to me what is happening=2E > >The same is not true for me for `using (file_for_write('file=2Etxt') as $= fh)` or even worse `using (new Manager() as $notActuallyTheManager)` (which= is part of the RFC)=2E Hi Tim, Thanks for your thoughts=2E I will definitely go over your other email in = detail when I have some more time and energy, and update some of my example= s=2E=20 Regarding this point, I think it's a really interesting observation, and I= wonder if we should be looking for different keywords that read more clear= ly=2E For instance:=20 using(new SomeManager() for $someResource) using($someResource from new SomeManager()) context(new SomeManager() giving $someResource) Regards, Rowan Tommins [IMSoP]