Search code examples
scalacontinuations

Question about Scala continuation


As I understand shift and reset are just library functions. Is it correct that all continuation stuff is implemented as a library and Scala compiler does not do any special work to transform the code inside the reset block?


Solution

  • No, that's not the case. Part of that support is in library and the other part in a compiler plugin. The compiler plugin transforms the code inside reset to continuation-passing form. You need to have this compiler plugin in your build process. In the runtime, scala standard library is sufficient.