Re: [RFC] Scope
| From: | Frode Børli | Date: | Sun, 01 Nov 2026 14:31:26 +0000 |
| Subject: | Re: [RFC] Scope | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-132984@lists.php.net to get a copy of this message | ||
I did go back and forth with terminology, but eventually landed on Scope. The term is used elsewhere
in php documentation, for example Closure::bind() etc, but context is used much more.
fiber-interop/api on packagist has a Scope polyfill, and I don't think personally that WeakMap
was hard to get right for scoped services. It takes getting used to, but it seems better than
storing data directly in the scope object.
With regards,
Frode Børli
Sendt fra Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Rowan Tommins [IMSoP] <imsop.php@rwec.co.uk>
Sent: Sunday, 01 November 2026 15:26:40
To: internals@lists.php.net <internals@lists.php.net>
Subject: Re: [PHP-DEV] [RFC] Scope
On 26/10/2026 16:03, Frode Børli wrote:
Hi internals,
I'd like to start the discussion on a new RFC:
https://wiki.php.net/rfc/scope
Hi Frode,
I'm really happy to see this as an independent, focussed, RFC, which can hopefully fit well
with the other async-related proposals being worked on.
In early versions of the "True Async" RFC, Edmond Dantes included a complex API for
attaching data to coroutine scopes, and I argued at the time that it could be simplified, and more
complex structures built on top of it later. It looks like that's exactly the approach taken
here, providing only the parts that are essentially impossible in userland.
I do share Larry's concern that some of the common patterns using WeakMap will be hard to get
right, but maybe that can be solved by additional helper classes and functions which might have
other uses anyway?
The only slightly trivial reaction I had was to the name: variable scope is something we talk about
so often, that I can see "variables tied to the current Scope" confusing people. Naming
things is notoriously hard, but I note that a lot of the other languages you reference use the word
"context" instead, and wonder if you'd considered that?
Thanks,
--
Rowan Tommins
[IMSoP]