gpt4 book ai didi

scala - Dotty 将如何改变 Scala 中的纯函数式编程?

转载 作者:行者123 更新时间:2023-12-03 23:54:46 26 4
gpt4 key购买 nike

this question从 2013 年开始,Odersky 先生指出,“现在判断”像 Scalaz 这样的库是否能够在 Dotty 下存在(至少在目前的状态下),由于高级类型和存在类型的阉割。

随着时间的流逝,Dotty 对 Scalaz & Cats 的影响是否已经阐明?内置效果和记录等提议的功能会改变这些项目的范围吗?

我知道 Dotty 距离取代 scalac 仍有一段距离,但当我考虑投入时间将纯函数式结构和方法应用于我的工作时,我认为考虑其旗舰库的 future 很重要。

最佳答案

Dotty 上最新的一个例子是“Scaling Scala” 作者:Chris McKinlay(2016 年 12 月 15 日)(同一篇文章还提到了 Scalaz 和 Cats 的情况)

Martin Odersky has been leading work on Dotty, a novel research compiler based on the Dependent Object Types (DOT) calculus (basically a simplified version of Scala) and ideas from the functional programming (FP) database community.

The team working on Dotty development has shown some remarkable improvements over the state of the art, most notably with respect to compilation times. I asked Odersky what he thought was novel about the Dotty architecture and would help end users. Here’s what he said:

Two things come to mind:

  • first, it's closely related to formal foundations, giving us better guidance on how to design a sound typesystem. This will lead to fewer surprises for users down the road.
  • Second, it has an essentially functional architecture. This makes it easier to extend, easier to get correct, and will lead to more robust APIs where the compiler is used as a service for IDEs and meta programming.


尽管 Dotty 开辟了许多有趣的语言可能性(特别是全谱依赖类型,如 AgdaIdris),但 Odersky 选择优先考虑使其立即对社区有用。语言差异相当小,其中大部分是为了简化语言(如删除过程语法)或修复错误(不健全的模式匹配)或两者(早期初始化程序)。

尽管如此,我还是忍不住问他是否有可能在某个时候在 Scala 中出现全谱依赖类型。这是他说的:

Never say never :-). In fact, we are currently working with Viktor Kuncak on integrating the Leon program prover with Scala, which demands richer dependent types than we have now. But it's currently strictly research, with a completely open outcome.



Scala 和 Dotty 团队正在密切合作以实现 Scala 2.x 和 Dotty 的融合,并且他们表示他们非常重视连续性。 Scala 2.12 和 2.13 具有解锁在 Dotty 中孵化的功能(例如,存在类型)的语言标志,并且 Dotty 编译器具有 Scala 2 兼容模式。甚至还有一个 migration tool .

关于scala - Dotty 将如何改变 Scala 中的纯函数式编程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41008319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com