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

From: Date: Tue, 04 Nov 2025 13:59:38 +0000
Subject: Re: [RFC][Discussion] use construct (Block Scoping)
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-129071@lists.php.net to get a copy of this message
On Mon, Nov 3, 2025, at 22:46, Seifeddine Gmati wrote:
> Hello internals,
> 
> Tim and I would like to open the discussion on our new RFC that we've been working on:
> "use construct (Block Scoping)".
> 
> We wanted to raise a few initial points:
> 
>  • The RFC proposes the `use keyword. What are your thoughts on a new
> using` keyword instead, similar to C# or Hack?
> 
>  • How do you feel about the questions raised in the "Open Issues" section?
> 
>  • What are your general thoughts on the RFC?
> 
> Please find the following resources for your reference:
> 
>  • RFC: https://wiki.php.net/rfc/optin_block_scoping
> 
>  • POC: https://github.com/php/php-src/compare/master...TimWolla:php-src:block-scope
> 
> Thanks,
> 
> Seifeddine Gmati.
> 

Hello,

One thing that isn't clear with this RFC is what happens to things redefined in the scope?

$a = 10;

use ($a = 5) {
  var_dump($a);
}

var_dump($a); // unset or 10?

— Rob


Thread (42 messages)

« previous php.internals (#129071) next »