如何在Scala中编程以与Dotty向前兼容 [英] How to program in Scala to be forward-compatible with Dotty
问题描述
最近在《怪圈》中的谈话中,马丁·奥德斯基(Martin Odersky)阐明了他对Scala未来版本的看法叫多蒂.我知道这是一个进行中的工作,由于许多可能的向后兼容问题,它甚至可能不会流入Scala(至少不是很快).但是,如果发生这种情况,我们今天应该如何在Scala中编程以与Dotty向前兼容?我没有从演讲中得到所有想法,所以我希望有一个更深刻的人来总结这些变化并描述我们如何为它们做好准备.
In hist recent talk at Strange Loop Martin Odersky shed the light on his vision of Scala's future version called Dotty. I understand this is work-in-progress and it even may not flow into Scala (at least not very fast) due to many possible backward-compatibility issues. But if it happens, how should we program in Scala today to be forward-compatible with Dotty? I didn't get all the ideas from the talk so I'd like someone more profound to summarize the changes and describe how can we prepare to them.
推荐答案
我要提出的唯一其他建议是,也要远离包含类型成员的结构类型.这些类型成员是使Scala中的类型检查完成的元素,但我不确定我们是否要在Dotty中支持它.仅包含val和def的结构类型可能会继续受支持.
The only other advice I would give is to also stay away from structural types containing a type members. Those type members are the elements that make type-checking in Scala turing complete, and I am not yet sure whether we want to support that in Dotty. Structural types that contain only vals and defs will likely stay supported.
这篇关于如何在Scala中编程以与Dotty向前兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!