How to program in Scala to be forward-compatible w

2019-03-08 14:49发布

问题:

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.

回答1:

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.



回答2:

Towards the end of the talk, he says "if your program is compiled without any language feature imports for higher-kinded and existentials then you should be ok".

So if I understand it correctly the only thing you would need to be aware of is any possible usage of existential types or higher-kinded types in your code.



标签: scala dotty