Re: RFC Karma request: native defer keyword (Zig-style)
| From: | Ilija Tovilo | Date: | Sat, 27 Dec 2025 22:27:12 +0000 |
| Subject: | Re: RFC Karma request: native defer keyword (Zig-style) | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129704@lists.php.net to get a copy of this message | ||
On Sat, Dec 27, 2025 at 9:14 PM Ilija Tovilo <tovilo.ilija@gmail.com> wrote:
>
> On Fri, Dec 26, 2025 at 4:41 PM Khaled Alam <khaledalam.net@gmail..com> wrote:
>
> > Inspired by Zig's "defer", it schedules a block to run when the current
> > function exits (return, exception, or natural end), executed in LIFO order, aimed at safer cleanup
> > without repetitive try/finally scaffolding.
Oh, and what I forgot to mention here (but not in the PR), there are
two recent RFCs that try to solve a very related problem.
- https://wiki.php.net/rfc/optin_block_scoping
- https://wiki.php.net/rfc/context-managers
Ilija