Re: [RFC] Context Managers, v2
| From: | Sjoerd Langkemper | Date: | Fri, 06 Nov 2026 14:51:37 +0000 |
| Subject: | Re: [RFC] Context Managers, v2 | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-133030@lists.php.net to get a copy of this message | ||
On Thu, Nov 5, 2026, at 18:33, Larry Garfield wrote:
> Context Managers RFC, Arnaud and I have a new approach to present:
>
> https://wiki.php.net/rfc/context-managers-v2
Thanks. It looks promising.
> When the using expression ends, VAR is explicitly unset().
What happens when VAR was already defined before the context? Is it masked and restored, or
overwritten and unset?
> what the return value of a combined using block should be
I would say the return value of the outer-most / left-most context manager. That is equivalent to
the nested form.
The compact comma separated syntax could also be added later, so if this is a difficult point it is
also possible to remove this from the RFC and add it later on.
> public function transaction(): self
Should the return type be Generator here?
Regards,
Sjoerd