Re: [RFC] Context Managers

From: Date: Tue, 07 Apr 2026 16:20:36 +0000
Subject: Re: [RFC] Context Managers
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-130588@lists.php.net to get a copy of this message
On Thu, Apr 2, 2026, at 5:13 AM, Tim Düsterhus wrote: >> continue means "stop this iteration of a control structure and go to >> the next one." But in this case, there is no next one. switch makes >> it an alias for break, for whatever reason lost to history, but given >> that it now throws a warning that seems to now be considered a mistake, >> so we don't see a reason to propagate that mistake. > > I think Rowan explained that well in his reply. > >> If you have an alternate suggestion for how to achieve this >> functionality, now is the time to propose it. > > As implied by my email, I believe that throwing exceptions should be the > job of the throw keyword, not the job of the > return keyword. > Otherwise users are going to wonder what makes `return new > SomeException(); different from throw new SomeException()` in > that > case. > > Best regards > Tim Düsterhus We've updated the RFC to address the break question (new section), the continue question (which is now a secondary vote), and expanded the reasoning for the return $e decision, including reference to the original Python PEP which explains the need for a distinction. --Larry Garfield

« previous php.internals (#130588) next »