开发者

nested CPS "reset"

开发者 https://www.devze.com 2022-12-28 07:30 出处:网络
using the CPS compiler-p开发者_运维知识库lugin of Scala 2.8, there are the two magic controls reset and shift. Reset delimits the continuation and shift captures the continuation.

using the CPS compiler-p开发者_运维知识库lugin 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消