On 4 March 2025 18:36:37 GMT, Larry Garfield <la...@garfieldtech.com> wrote:
>PHP doesn't have Python-style context managers (though I would like them)
So would I, I've actually thought about it a lot...
But more importantly, this highlights something important about that Python
library: it is built *on top of* a native async/await system which is baked
into the language (note the example uses "async with", not normal "with").
That reinforces my earlier feeling that this RFC is trying to do far too much
at once - it's not just about "low-level vs high-level", there's multiple whole
features here:
- asynchronous versions of native functions, and presumably a C API for writing
those in extensions
- facilities for writing coroutines (async/await, but not as keywords)
- deferrable "microtasks"
- event/signal handling functionality
- communication between threads/fibers via Channels
- a facility for launching coroutines concurrently (as Python demonstrates,
this can be separate from how the coroutines themselves are written)
- maybe more that I've overlooked while trying to digest the RFC
Having all of those would be amazing, but every one of them deserves its own
discussion, and several can be left to userland or as future scope in an
initial implementation.
Rowan Tommins
[IMSoP]