All I can think coming away from this is:
This still seems pretty useless, It'd be nice if java could allow for static interface methods.
interface Program {
static void main(String...args);
}
And then I digressed - heavily.There have been several times when I've wanted static methods that apply to the specific class - although many of the situations could be shoehorned into a constructor, it's not the best.
You'd also want something like a 'This' meta-class keyword.
interface Foo extends Comparable<This> {
static This(A argA, B argB);
static This difference(This v0, This v1);
static int compare(This v0, This v1);
default int compareTo(This other){
return compare(v0, v1);
}
}
/*
I want to return an instance of my class' own type (defined in a subclass an so unknown),
so I pass every implementation itself as its own generic parameter.
*/
interface Why<W extends Why<W>> implements Comparable<W>{
W someManipulation();
}
class Foo implements Why<Foo> {
@Override
Foo someManipulation(){
....
}
}
To be honest, I think I reacted to how robust this does not feel.It also blurs the line between static and instance syntax/functionality in a way that does not seem useful - and given that this is intended to reduce barriers to entry, is quite probably harmfully confusing.