...
- mixins == good
- static but not always explicit types; no casts; allow implicit downcasting but warn about all other issues; check downcast at runtime.
unsafe: List<Object> a = List<String>? compile error. Is List<Number> castable to List<Integer>? covariance. watch out for ((Object[])(new String[1]))[0] = 3.
I like idea of covariant method args for overriding. http://www.artima.com/scalazine/articles/scalas_type_system.html talks about Cow overriding animal eat(Food) but wanting to restrict to eat(Grass); can't in java. might need polymorphic arg dispatch. abstract types seem useful. I think Java allows us to override the return type now.Code Block class T { T foo() { return null;} } class U extends T { U foo() { return null;} }
- if generics, "reify" them (keep types around at runtime) unlike java.
- pattern matching as lib?
- keep smalltalk like (typed) syntax?
I use => return type so type names make sense like ML and descendants: (int, Object => void)Code Block at: int i put: Object value => void { ... } size => int { ... }
Neil Gafter's lambda notation is similar for java:Code Block ()->int[] arrayLambda = ()->new int[]{1, 2, 3};
...