>> >> This example highlights one of the concerns I have with fibers and this approach in general. That example will still execute synchronously, taking file_get_contents() * 3, even though it is in a coroutine function. >>
>Is that really a problem? If a programmer wrote the code `$x = 1 / 0`, then the issue is definitely not with the division operation. It is a problem. IO file operations are async on linux. You have to manually type the `sync` command to be sure if you copy something to another drive. So having a file_get_contents x3 will surely be executed but file_put_contents will delay On Thu, Mar 20, 2025 at 7:57 PM Larry Garfield <la...@garfieldtech.com> wrote: > On Thu, Mar 20, 2025, at 2:06 AM, Edmond Dantes wrote: > > This is simply a wonderful explanation. I will be able to go through > each point. > > > > But before that, let's recall what spawn essentially is. > > Spawn is an operation that creates a separate execution context and > > then calls a function within it. > > To perform this, spawn requires two things: > > 1. **callable** – something that can be called; this is an expression > > or the result of an expression. > > 2. **argument list** – a list of arguments. > > Nitpick to make sure we're talking about the same thing: What does > "Separate execution context" mean here? Because a keyword whose > description includes "and" is always a yellow flag at least. (See also: > readonly.) One thing should not do two things. Unless what you mean here > is it creates a logical coroutine, within the current async scope. > > (I suspect this level of nitpickiness is where the confusion between us > lies.) > > --Larry Garfield > -- Iliya Miroslavov Iliev i.mirosla...@gmail.com