加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何在Scala中启用延续?

发布时间:2020-12-16 09:46:13 所属栏目:安全 来源:网络整理
导读:问题都说了 (然而,多年来,如何获得转移和重置操作的细节已经有所改变,老博客条目和Stack Overflow答案可能会有过时的信息。) 另请参阅What are Scala continuations and why use them?,它说明了一旦你有了移动和重置,你可能会想做什么。 解决方法 Scala
问题都说了

(然而,多年来,如何获得转移和重置操作的细节已经有所改变,老博客条目和Stack Overflow答案可能会有过时的信息。)

另请参阅What are Scala continuations and why use them?,它说明了一旦你有了移动和重置,你可能会想做什么。

解决方法

Scala 2.11

最简单的方法是使用sbt:

scalaVersion := "2.11.6"

autoCompilerPlugins := true

addCompilerPlugin(
  "org.scala-lang.plugins" % "scala-continuations-plugin_2.11.6" % "1.0.2")

libraryDependencies +=
  "org.scala-lang.plugins" %% "scala-continuations-library" % "1.0.2"

scalacOptions += "-P:continuations:enable"

在您的代码(或REPL)中,请导入scala.util.continuations._

你现在可以使用shift和重置你的心脏的内容。

Scala 2.8,2.9,2.10的历史信息

您必须使用-P:continueations启用scala(或scalac):启用标志。

在您的代码中,请导入scala.util.continuations._

你现在可以使用shift和重置你的心脏的内容。

如果您使用的是sbt 0.7,请参阅https://groups.google.com/forum/#!topic/simple-build-tool/Uj-7zl9n3f4

如果您使用sbt 0.11,请参阅https://gist.github.com/1302944

如果您使用maven,请参阅http://scala-programming-language.1934581.n4.nabble.com/scala-using-continuations-plugin-with-2-8-0-RC1-and-maven-td2065949.html#a2065949

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读