Re: Examples comparing Block Scoped RAII and Context Managers
| From: | Larry Garfield | Date: | Sat, 13 Dec 2025 15:58:22 +0000 |
| Subject: | Re: Examples comparing Block Scoped RAII and Context Managers | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-129603@lists.php.net to get a copy of this message | ||
On Tue, Dec 2, 2025, at 1:57 PM, Larry Garfield wrote:
> We're very open to tweaking the keywords. I can see the argument for
> "as" being a little misleading in PHP's case. Though I'd prefer to
> have the EXPR first and VAR second, whatever the keyword is.
>
> Another potential we thought of: Just plain =>. It already doesn't
> imply equals, would have no keyword breaks, and is still only 2
> characters.
>
> using (new SomeManager() => $someResource) {
> // ...
> }
>
> Thoughts?
>
> --Larry Garfield
Rowan (or anyone else), did you have thoughts here? Would => be a more self-explanatory symbol
to use for the context manager block?
--Larry Garfield