Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129512 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 AD1101A00BC for ; Tue, 2 Dec 2025 19:57:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1764705449; bh=kmRRxMxkjk4EpqiQLJ8Jk+iOLVLnzt7v8Xyutl1+Q0Q=; h=Date:From:To:In-Reply-To:References:Subject:From; b=GmiliyOTnbBt8d13rztdF0/oayxBcvpb71Xpwe0Sl3XAKR3GhDUhQ2TpfGBiFDmHp XUpmi+zK54oykDMTxe49hqZrkwCUxuTK6AzAXNpXlJXxZTTXqNLReum8vObcnIkLHs rHrb54Eyw6M9xJxv0PnUBxanjMjWo5WKyfQ9k+wQtjlKZiWMgFUZ6YFxbNTNkMnGwK ArGfX1mgZu1vT2Lkeci9eQUrbfyC6eEOkztGYdcMGhksMgq95tIpcO/lTdI5srmdE5 Bzrjhi/JOviWB6qpr9Mo+RPg6aHiZIKIxjUjc1QheFfgo8cBNetvQkFvZUcgaCYLfl Fm/k1e39LHguw== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 67733180077 for ; Tue, 2 Dec 2025 19:57:28 +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.9 required=5.0 tests=BAYES_20,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 ; Tue, 2 Dec 2025 19:57:27 +0000 (UTC) Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id 88D0A140016A for ; Tue, 2 Dec 2025 14:57:22 -0500 (EST) Received: from phl-imap-01 ([10.202.2.91]) by phl-compute-04.internal (MEProxy); Tue, 02 Dec 2025 14:57:22 -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=fm1; t=1764705442; x=1764791842; bh=A6GgycpTi4kfvaubrDXDG xJ/4Gyky/9f8RLVGmGP06w=; b=DxY01rgbYlZUSzYOk638Yl6M7NccgFUpRA85W H8ac3YGrz1hQ1kQBGuCAs5OZ0crBG5ctgjkr7rEuPvj0tKYPC+8NguRwHBthuo9o PORix8a/ONCLs4IpiBJpHIVmkOzbn7B6h8TVeNLQ9fQNnG+S8+ZZ2lgtAOGVsqiS fm+eUuGbUwwOMPsIekUYqcH4pw32w1GZhDxOFeLRF1Y48Dsi3iws8YUHcYKD/2jr 5QfLHPGOVbYQ6rLhfd/bLwIedit2qoKa+6n56I6sLoQkN2G7IWIrOaNcaf7RJDM2 dqtJkV5jVt6zv+th55cUfVnVVTjYz882EC/ApC+BSgORRBN/w== 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=1764705442; x=1764791842; bh=A 6GgycpTi4kfvaubrDXDGxJ/4Gyky/9f8RLVGmGP06w=; b=rSpmxe8o9IceCSzDQ /FpAe5Uh5VCHKMYp3WxS2gWsFffMyEIgbxpS1lxea4uoQBgjzYIuBuyz8srn985J NRsGGTaf/YQQIRnA/sToCmBmoe+AvkAhW09O6AvkMo8p1ucv58S7/Dj+6PL4UYIh R6BWKQW0da9199t3updtk5suo4UKnLNJkX3UmyNQyY9C41dYlX61qLZjh7AbAz6A PkSmA13ex2puY8TablXSIuNsP7HetfUf2Ktx+/m1JxKxm2NYH16qnXYVc8EcEOci YGR2tRr/mtllkDCWdPj6g7zHhUPnRfaIfuqiOQTn9aEbS+4/0nQ1fq36DsQM54rG FachA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddutdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceurghi lhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurh epofggfffhvffkjghfufgtgfesthhqredtredtjeenucfhrhhomhepfdfnrghrrhihucfi rghrfhhivghlugdfuceolhgrrhhrhiesghgrrhhfihgvlhguthgvtghhrdgtohhmqeenuc ggtffrrghtthgvrhhnpeffieeivdfhvdeguddttdegteeiueegvefhteehfeeffeetudei tdehtdegjeeuieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehlrghrrhihsehgrghrfhhivghlughtvggthhdrtghomhdpnhgspghrtghpthht ohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrhhnrghlsheslh hishhtshdrphhhphdrnhgvth X-ME-Proxy: Feedback-ID: i8414410d:Fastmail Received: by mailuser.phl.internal (Postfix, from userid 501) id 1924318C004E; Tue, 2 Dec 2025 14:57:22 -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: AQWJq8Gl4GWJ Date: Tue, 02 Dec 2025 13:57:00 -0600 To: "php internals" Message-ID: <08966c87-cdd0-4402-9dcb-098e7b327d9a@app.fastmail.com> In-Reply-To: References: <26a2f13c-f318-4d6c-9595-bfaaebcbabcb@rwec.co.uk> <432ca4ad-7bcc-43bd-8e05-3121839b4ff7@app.fastmail.com> <6ca9d7e54c291d1ce8fd74b5d1977034@bastelstu.be> Subject: Re: [PHP-DEV] Examples comparing Block Scoped RAII and Context Managers Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: larry@garfieldtech.com ("Larry Garfield") On Thu, Nov 27, 2025, at 8:43 AM, Rowan Tommins [IMSoP] wrote: > 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 = directly is not the 'as', but the 'each' part of the 'foreach'. Just by = reading it as a English sentence, it becomes clear to me what is happeni= ng. >> >>The same is not true for me for `using (file_for_write('file.txt') as = $fh)` or even worse `using (new Manager() as $notActuallyTheManager)` (w= hich is part of the RFC). > > > Hi Tim, > > Thanks for your thoughts. I will definitely go over your other email i= n=20 > detail when I have some more time and energy, and update some of my=20 > examples.=20 > > Regarding this point, I think it's a really interesting observation,=20 > and I wonder if we should be looking for different keywords that read=20 > more clearly. For instance:=20 > > using(new SomeManager() for $someResource) > > using($someResource from new SomeManager()) > > context(new SomeManager() giving $someResource) > > Regards, > > Rowan Tommins > [IMSoP] We're very open to tweaking the keywords. I can see the argument for "a= s" being a little misleading in PHP's case. Though I'd prefer to have t= he EXPR first and VAR second, whatever the keyword is. Another potential we thought of: Just plain =3D>. It already doesn't im= ply equals, would have no keyword breaks, and is still only 2 characters. using (new SomeManager() =3D> $someResource) { // ... } Thoughts? --Larry Garfield