On 21/01/2021 16:13, fo...@univ-mlv.fr wrote:
OK, so it is the "target to argument shifting" that is weird to
you? That when we declare a static pattern, there is a special
first argument that is the target ?
The sementics implies an instanceof on something which is not not
visible in the syntax.
People, me including, will have hard time to debug that, why this
pattern is not chosen, oh, it's because of the instanceof.
I get where you are coming from. But isn't this "more of the same" e.g.
the same "problem" we have with unbound method references?
interface Foo {
void m(Bar b, String s);
}
class Baz {
void print(String) { ... }
}
Foo foo = Baz::print // error - why? Ohhh Baz is not a Bar...
In other words, there are other parts of the language where we play
around the edges of the static vs. non-static boundary by sprinkling
some inference - isn't a static pattern another of those cases?
Cheers
Maurizio