Which functionality/feature in Scala only exists as a concession to the underlying platform and should be removed if targeting something else?

那年仲夏 提交于 2019-12-03 09:32:47

The AnyVal type branch could burn in eternal hell fire. Arrays could be implemented in a sane way (okay, the ugliness is hidden pretty well now), same for reified types. The methods clone, hashCode and toString could go into type classes where they belong. Currying could be implemented without multiple arg lists. Type inference and type level programming could be improved.

null, null, null, and null

Type erasure. Having every object have a monitor reference (a horrible Java mis-feature).

Kipton Barros

I hope that a Scala port to LLVM include user-defined value types (like struct types in CLR). The issue is avoiding heap allocation. For example, in scientific computing there is a need for abstractions like arrays of complex numbers, but heap allocating each complex number is too costly (in terms of space and cache misses).

Edit: Maybe the JVM will get value types too. John Rose, a JVM engineer, discusses how value types might be added. There are recent rumors that Oracle plans to add value types for better support of high performance computing.

Syntax, mostly to not scare away existing java developers.

And entire "let's marry objects with functional programming, because java works only with objects".

Without the need to integrate with existing OO libraries there would be no need to castrate type inference, to make an ugly kludge in form of case classes to support pattern matching.

Heck if you look at it, without JVM there would be no Scala, because most of the compromises simply do not make sense if taken out of context of seamless integration with java world.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!