嵌套CPS“重置”(nested CPS “reset”)

编程入门 行业动态 更新时间:2024-10-19 19:37:17
嵌套CPS“重置”(nested CPS “reset”)

使用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.

更多推荐

本文发布于:2023-08-06 21:46:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1456631.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:嵌套   CPS   reset   nested

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!