One of the biggest obstacles to dropping class copying is that we wouldn't be conveniently able to use threads in single-file scripts anymore.
In addition, having to declare a whole class just to run a couple of lines of code is quite annoying and cumbersome.
This would be eased if we could run threads using just closures, similar to ext-parallel. A compatibility layer could then use closures in this manner to preserve backwards compatibility:
$task = new SomeTask();
$worker->stack(fn() => $task->run());
Similar limitations would have to be imposed on the usable closures, like in parallel, such as disallowing declaration of classes.
One of the biggest obstacles to dropping class copying is that we wouldn't be conveniently able to use threads in single-file scripts anymore. In addition, having to declare a whole class just to run a couple of lines of code is quite annoying and cumbersome.
This would be eased if we could run threads using just closures, similar to ext-parallel. A compatibility layer could then use closures in this manner to preserve backwards compatibility:
Similar limitations would have to be imposed on the usable closures, like in parallel, such as disallowing declaration of classes.