Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:129586 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 85A6D1A00BC for ; Wed, 10 Dec 2025 20:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1765398757; bh=/E/QxQB/T5T3pgx/oBY2ezo3VAAaQ2QN66UPGfoV0E0=; h=Date:From:To:Subject:In-Reply-To:References:From; b=Qgw6A8NAkyCjk3qAbfVtCj04PJ0H6znw108ydNx0o5RR/HsvLUnjy9M20lHa7IzWX OD5Pf0F5FjA4m5C3T8ppGu/vxjwlZO+HVxV7zoFR9IcKeL0TKVOuy3J8oP19UX4RHx CwIfKH1KOkjRS5qwcCF6vWjvqcg1MHcIJCAAKfW1JT1y5DuL9PF9gLhnyLW2vosa50 Y7nMEL4IWg1o9NyBAQeiYfe3EzSBYRDYRzXkkeXnrXjUG1GLGMQUDOASe3PaRkW2ci 53ONLX5CunXItjDH6hTyCjdZ4KIUMST4qzM20vC2pXMXPjqj+acFRudMuXVyMzmyM1 jjYIOTrHR6yUg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 48AB9180087 for ; Wed, 10 Dec 2025 20:32:36 +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.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=4.0.1 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (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, 10 Dec 2025 20:32:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1765398748; bh=hNN0Kd/KnDafUeFJCrXp5F+g4IJZYr8CKLbdAuK8nD8=; h=MIME-Version:Date:From:To:Subject:In-Reply-To:References: Message-ID:Content-Type:from:to:cc:subject:message-id; b=LcNDIlN9F3xd6JYg1LZ96tzpfOD3NXaxIs3vLojhz7N/ARahzG4d8PbzUoEAXlQws rdOudDao1GW3Lw3xewb6rhVdU0Zj1xTu+dGB0vIG3S2ANqCNGRzY+XrkO3Gc1bcrRp WxYxhwEykB8R+iiTs1UG4W+MfAcK4Uc/cS4LSl5BfdhVmZj2oACZRo9Qyn7txY7NNB 6TmDRLw7KsJxYM/b5jF147deb4gtYFkOdIJnuJFO3whSKgKvSNwJVYUqfpkjy5B684 hVCx9v/0vcB6HljNhaHYROTrmwqh0pBMC+tKLs44twaUNlQhsNJqNrX5jhhPAhuL5k 12AQNcbvyjQ7A== Precedence: list list-help: list-unsubscribe: list-post: List-Id: x-ms-reactions: disallow MIME-Version: 1.0 Date: Wed, 10 Dec 2025 21:32:28 +0100 To: Seifeddine Gmati , internals@lists.php.net Subject: Re: [PHP-DEV] [RFC][Discussion] use construct (Block Scoping) In-Reply-To: <99421ea8-b7ef-4049-aa74-31e8433309a8@bastelstu.be> References: <99421ea8-b7ef-4049-aa74-31e8433309a8@bastelstu.be> Message-ID: <695195e629639d2fab45547ab7c1b19a@bastelstu.be> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=C3=BCsterhus?=) Hi I just became aware of a mistake in the desugaring at the start of the proposal section: The value of `$c` was not correctly kept after breaking the reference with `unset($c)`. This was fixed by adding a `$c = $c_original;`. The "Simple example" in the Examples section already correctly represented the intent with the `$b` variable, where it still is `"original b"` within the `let()` block. I have also clarified in the desugaring that when the original values are restored after the block that the restored values will become a reference again if it originally was a reference. As far as I am aware this is not representable purely with PHP code, so it's just noted in the comment. Diff is at: https://wiki.php.net/rfc/optin_block_scoping?do=diff&rev2%5B0%5D=1763913496&rev2%5B1%5D=1765398288&difftype=sidebyside Best regards Tim Düsterhus