比较下 C 和 Java 过程式/面向对象(过程式 + OO 系统...)更像平时我们解决问题的方式,数学的则更理想化一些,所以还搞个 Monad 函子屏蔽副作用,纯纯 naive 的世界
(233) #Ruby 里的 Fiber 不就是 Lua 里的 coroutine 嘛(
现在还不理解 coroutine 和基本的生产者 - 消费者队列,所以不能下结论
现在还不理解 coroutine 和基本的生产者 - 消费者队列,所以不能下结论
Fibers are primitives for implementing light weight cooperative
concurrency in Ruby. Basically they are a means of creating code blocks
that can be paused and resumed, much like threads. The main difference
is that they are never preempted and that the scheduling must be done by
the programmer and not the VM.
As opposed to other stackless light weight concurrency models, each
fiber comes with a stack. This enables the fiber to be paused from
deeply nested function calls within the fiber block. See the ruby(1)
manpage to configure the size of the fiber stack(s).