[External] : Re: The good and the bad static pattern ?

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Fri Jan 22 13:26:41 UTC 2021


On 21/01/2021 16:13, forax at 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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/amber-spec-experts/attachments/20210122/ea33a4ea/attachment-0001.htm>


More information about the amber-spec-experts mailing list