使用Scala 2.8的CPS编译器插件,有两个魔术控件reset和shift 。 重置界定延续,并且转移捕捉延续。
有一个使用CPS和NIO的例子 ,使用嵌套重置作为“分叉”类型......? 我不完全理解嵌套复位的目的,有什么影响?
using the CPS compiler-plugin of Scala 2.8, there are the two magic controls reset and shift. Reset delimits the continuation and shift captures the continuation.
There is an example of using CPS with NIO, using nested resets as a type of "forking"...? I don't exactly understand the purpose of nesting the resets, what's the effect?
最满意答案
嵌套reset没有什么魔力。 shift适用于包含它的最内层reset 。 您看到的伪分支注释仅仅是从NIO选择器注册的回调中描述的有效行为。
There's nothing magic about nested a reset. A shift applies to the innermost reset that encloses it. The pseudo-forking comment you see is just a description of the effective behavior from the callbacks registered with the NIO selector.
更多推荐
发布评论