Coroutine::create是否有必要直接执行代码 #6066
BinaryAlan
started this conversation in
General
Replies: 5 comments 2 replies
|
有道理, 但是BC 有点点大😅 |
0 replies
|
这块不会改了,如果你只是单纯想 create 一个协程,可以用 <?php
new \Hyperf\Engine\Coroutine($callable); |
1 reply
|
挺好的建议,但 BC 的确有点大,Maybe 到 4.0 的时候再考虑 |
0 replies
|
v3.1 先增加 run,保留 create 作为 run 的别名,v4.0 声明 create 废弃,v5.0 移除。 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
1、从函数语义上上来说,create只是创建,不应包含run/execute的操作
2、创建即执行的设计在多个Coroutine::create放在一起的场景,代码会变成同步执行的效果
3、从正交性上来说,异步和同步的设计有重合的范围,不够合理
综上,建议
create的函数名可以改成runAll reactions