Re: [VOTE] let construct (Block Scoping)

From: Date: Sat, 24 Jan 2026 14:13:57 +0000
Subject: Re: [VOTE] let construct (Block Scoping)
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-129910@lists.php.net to get a copy of this message
Hi, On Fri, Jan 23, 2026 at 10:59 AM Benjamin Außenhofer <kontakt@beberlei.de> wrote: > I agree that relying on reference counting can bite you, but I still voted Yes, because > > We only have reference counting to rely on in PHP as far as memory goes For disposal, only if we decide so. The RFC proposes to introduce block scoping, and could have made the decision to deterministically dispose of values as they go out of scope. The RFC refers to similar features in Python and Hack, with the same basic syntax, both of which use reference counting as primary garbage collection mechanism, yet disposal is deterministic in this context. > and thats what people writing cleanup critical code rely on already. This gives a much nicer > syntax. In my experience, relying on this causes occasional bugs that are unusually difficult to address (and to avoid in the first place). > The future scope lists improvements as next steps, like the error when RC > 1 or Disposable > interfaces, this is a first step towards something that is missing dearly. Unfortunately these improvements won't make it because they will be breaking changes. Best Regards, Arnaud

« previous php.internals (#129910) next »