Re: [RFC][Discussion] use construct (Block Scoping)

From: Date: Wed, 10 Dec 2025 20:32:28 +0000
Subject: Re: [RFC][Discussion] use construct (Block Scoping)
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-129586@lists.php.net to get a copy of this message
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

« previous php.internals (#129586) next »