- Tupples in function results
def f(a: int, b: int) : (int, int) = (a/b, a%b) - type Nothing and Null (like NONE and ANY in Eiffel)
- Object definitions
object Singleton { }
- Parameterless methods, that can be overridden by fields and vice versa.
class Circle(radius:double) {
def diameter = 2*radius
}
...
new Circle(5).diameter - Subtyping of generics (so-called co-variant subtyping). I miss this feature in Java:
def Iterator[+E] ...
now Iterator[String] will assign to Iterator[AnyObj]. - Pattern-matching expressions? Need to try it.
Some of these I was missing since I programmed in Eiffel back in 1995.
Features I am not so fond of:
- Case classes (a-la subtyped enums?)