计算机科学 > 程序设计语言
[提交于 2018年12月19日]
标题:Coroutines with Higher Order Functions
查看原文 PDF 中文 PDF (下批处理) EasyResearch 阅读摘要:Coroutines are non-preemptive concurrent subroutines that, unlike preemptive threads, voluntarily transfer control between each others. Introduced in the 60s before loosing in popularity in the 80s, they have seen a regain of interest in recent years, thanks to how elegantly they can solve numerous algorithmic problems. Unfortunately, some mainstream languages still lack support for coroutines, hence requiring either the use of non-standard interpreter/compilers, or elaborate hacks in thrid-party libraries. In this short paper, we propose a very simple way to implement coroutine-like components on the top of any language that support or can emulate higher order functions. We accompany our explanations with a handful of examples in JavaScript.
提交历史
来自:Dimitri Racordon[v1] 2018年12月19日 星期三 22:37:59 UTC