Re: [RFC] Scope functions

From: Date: Thu, 07 May 2026 13:12:24 +0000
Subject: Re: [RFC] Scope functions
References: 1 2 3  Groups: php.internals 
Request: Send a blank email to internals+get-130793@lists.php.net to get a copy of this message
On 7 May 2026 13:16:27 BST, Bob Weinand <bobwei9@hotmail.com> wrote: >> I don't know if there's some way to make the lifetime even more restricted, so >> that the use cases of "immediate execution" are allowed, but this kind of code is not. > >Have you missed this following restriction and example in the RFC? > >> Re-evaluation: The same scope function declaration (same source code location) invalidates >> the previous instance. Should it still be called, an error is raised. I skimmed past that section, and didn't realise its significance, thinking it was just covering off edge cases of the implementation. I think the core principle behind the various restrictions needs to be made much clearer in the summary of the proposal, because up to that point all the examples just look identical to normal closures with automatic capture by reference. For similar reasons, perhaps a different keyword would be better, so that users don't have a wrong expectation of what it means. Regards, Rowan Tommins [IMSoP]

« previous php.internals (#130793) next »