Coroutine::create是否有必要直接执行代码 #6066
BinaryAlan
started this conversation in
General
Replies: 5 comments 2 replies
-
有道理, 但是BC 有点点大😅 |
Beta Was this translation helpful? Give feedback.
0 replies
-
这块不会改了,如果你只是单纯想 create 一个协程,可以用 <?php
new \Hyperf\Engine\Coroutine($callable); |
Beta Was this translation helpful? Give feedback.
1 reply
-
挺好的建议,但 BC 的确有点大,Maybe 到 4.0 的时候再考虑 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Swow 其实重新思考了各种类似的历史包袱问题,但是在框架兼容后又不可避免地回到了「不严谨」的模式… 所以 BC 真的很难。 ![]() ![]() |
Beta Was this translation helpful? Give feedback.
1 reply
-
v3.1 先增加 run,保留 create 作为 run 的别名,v4.0 声明 create 废弃,v5.0 移除。 |
Beta Was this translation helpful? Give feedback.
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
的函数名可以改成run
Beta Was this translation helpful? Give feedback.
All reactions