Re: [RFC] Context Managers

From: Date: Wed, 26 Nov 2025 23:29:29 +0000
Subject: Re: [RFC] Context Managers
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-129462@lists.php.net to get a copy of this message
On 2025-11-27 06:48, Larry Garfield wrote:
* Is there any interest in turning using into an expression rather than a statement, so that it can be used in expression contexts? What would it evaluate to? The value returned by exitContext()? That's already controlling whether caught exceptions are rethrown, so the only value that would ever reach an enclosing expression would be "true".
(I've sometimes thought about making return an expression in the same spirit as throw. Its evaluated type would of course be "never" since any enclosing expression would be abandoned.) Morgan

Thread (33 messages)

« previous php.internals (#129462) next »