Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129646 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 2D5BF1A00BC for ; Wed, 17 Dec 2025 23:04:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1766012681; bh=w904PZRAZ0gD3ffHu/6Ao3HJXP5zDlQPaEKxvNlBjDI=; h=Date:From:To:Subject:In-Reply-To:References:From; b=L7O4TUzhbyKjALZJF1czJlX+Y6WJL7SioXO5/DjlrgYAV6G7DbIk8STmmhLMsgHPf M0v4e7/M6S1NGHixI0DO8m9RPLfnm0O0OvmZG7hhA160GG0ChdanmNpWMeZVGXFJdP FT7FIEBUWVyZtdmU+3K5vQq9MlmN0+d2vOXhc0v4MDVZyCAVszBx+Q9v97JUlvuUPR Hdc3b/Nbqi2Lxh+sS3rYrIxgVHMBNGdPMw4lKuGjDWByqtxtHYJez+CY2/kalnMUN5 le69/Fx7VfuT8eyVWz2I79qSlQ1rUNHB7d6Sj650Rk962P0jGM3BkownrBQjBzYFeV FggxameiWC18g== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id B2AAA180050 for ; Wed, 17 Dec 2025 23:04:40 +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_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (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, 17 Dec 2025 23:04:30 +0000 (UTC) Received: from phl-compute-05.internal (phl-compute-05.internal [10.202.2.45]) by mailfhigh.phl.internal (Postfix) with ESMTP id D31CF14000C8; Wed, 17 Dec 2025 18:04:24 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-05.internal (MEProxy); Wed, 17 Dec 2025 18:04:24 -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=1766012664; x=1766099064; bh=kwAt9MzSwk01VH6Rd6UAyRZiVaSeAkaDHeVUvXNKTd4=; b= p0SnHRBv+s2rZxQ2osFS1hW4V1c4fvPHvy3x7cjTuB0YB3s5xaM8V2osg4pdNEA9 CX59xRPUKB1XCi9kyQVkdCBVxUILRwmdlTPcTLTms4TAgVzVuq/weHxCJm7xXju+ VmvGGqUlKJJ6BGaGWDi4L80sIFmJ7UEWcpV3jb3r9r+PmP5wMNjcW1yGxNlB9/No Eq/bVYtrNJNG3MJzhRvDJ+zD1X9t/UlH3qdkSOOzQR7lLl+QXtFgyr6F+bKItO+g 1AQUqb/VXZfuE/94430uHudVKDPYNUn6/8DnAs6fydW+kR60+r8+Rm9F37Ob3jTx 0FJOFnee9kmd4VXG/2u1qQ== 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=1766012664; x=1766099064; bh=k wAt9MzSwk01VH6Rd6UAyRZiVaSeAkaDHeVUvXNKTd4=; b=hzRGnr766JHFrnbXQ j0tMVy8BB2ahY2WUs/Eelj8CgrApMBIDvpItLo0gDB7+X+y5LRsEpV9EAtr13PXw WbCeX1tV+/mZs5rWHCqE4iRXFebZ7mIqJNGnA0TKudeEH/77ecSahkyt5e5Dh1HP 5KxHGc/UuPxuO/mgTg32OifeZj/1W7rHEPWEV8xdtYm/OSlbvSEC9p55/YckACw+ kyH5CF1VfG8MJ5e4MEtnipKWbIaRDUPUcDvPGn4webtDD6ABe5+pLUm3P8OrQJ19 YJf37y3xBdJBrDIpWiFsy+m2z/HMNO2yn0BMvpEQ4mRyjSYqMMHO8zeIo/0TggE8 zJGQw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgdegfeekfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr ihhlohhuthemuceftddtnecunecujfgurhepfffhvffufggjfhfkgggtgfesthhqmhdttd erjeenucfhrhhomhepfdftohifrghnucfvohhmmhhinhhsucglkffoufhorfgnfdcuoehi mhhsohhprdhphhhpsehrfigvtgdrtghordhukheqnecuggftrfgrthhtvghrnhepfeefge elheffveegledvteehhfffkefhiefhvefgieeiuddtvdelkeefuddtgfelnecuffhomhgr ihhnpegvgihtvghrnhgrlhhsrdhiohenucevlhhushhtvghrufhiiigvpedtnecurfgrrh grmhepmhgrihhlfhhrohhmpehimhhsohhprdhphhhpsehrfigvtgdrtghordhukhdpnhgs pghrtghpthhtohepvddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepihhnthgvrh hnrghlsheslhhishhtshdrphhhphdrnhgvthdprhgtphhtthhopehtihhmsegsrghsthgv lhhsthhurdgsvg X-ME-Proxy: Feedback-ID: id5114917:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 17 Dec 2025 18:04:23 -0500 (EST) Date: Wed, 17 Dec 2025 23:04:21 +0000 To: internals@lists.php.net, =?ISO-8859-1?Q?Tim_D=FCsterhus?= 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: References: <26a2f13c-f318-4d6c-9595-bfaaebcbabcb@rwec.co.uk> <78bfa50ad7c5111a1c6caaff3a525255@bastelstu.be> Message-ID: <52165B35-D495-40C8-97B3-9684ED30F220@rwec.co.uk> 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 17 December 2025 19:59:54 GMT, "Tim D=C3=BCsterhus" = wrote: > let ( > $scoped =3D new Scoped(), > $scoped, > ) { My attempts to guess what this would do went something like this:=20 1) The second mention of $scoped does nothing, you've already declared it = as scoped to this block 2) That seems trivial for the compiler to spot, so probably an Error 3) Maybe it overwrites the variable to null? But that would make the lifet= ime shorter, not longer 4) So, somehow, there are two variables, with the same name, and they both= live until the end of the block? 5) Wait, does that mean this is just a sequence of declaration statements = in disguise? It feels like this completely goes against everything you've been saying a= bout avoiding the ambiguity of ALGOL-style declarations=2E If you can do that, presumably you can do this:=20 let( $foo =3D bar($baz), // What is $baz referring to? Particularly if it = is a by-reference out parameter=2E $baz =3D 1, ) Which is a direct translation of an example you gave here: Thinking about it, even the dynamic coding features of PHP you say would b= e so difficult aren't automatically prohibited:=20 let( $foo =3D compact('bar'), $bar =3D extract($foo), ) =20 and so on=2E=20 I kind of hope I'm misunderstanding something here, because this feels lik= e a pretty big hole in the premise=2E Rowan Tommins [IMSoP]