You're right, but we're down to enumerating special cases where this can be
made to work without using a declared type, and that seems fragile. It's
how you get massive pitfalls like the "runtime object implements Map"
situation we have now.

On Thu, Apr 29, 2021, 14:03 Remi Forax <fo...@univ-mlv.fr> wrote:

>
>
> ------------------------------
>
> *De: *"Christopher Smith" <chry...@gmail.com>
> *À: *"dev" <dev@groovy.apache.org>
> *Envoyé: *Jeudi 29 Avril 2021 19:38:27
> *Objet: *Re: () call-type syntax for functional interfaces?
>
> Also an object implementing multiple functional interfaces. In dynamic
> mode, you wouldn't know which method to invoke.
>
>
> if that object is a lambda proxy, i.e. an object created by a Java lambda,
> the only way to implement several functional interfaces is to have default
> methods,
> those methods are defined in their respective interfaces, not in the
> lambda class.
>
> You can have several methods in the lamba proxy class either because you
> have method of java.lang.Object (equals/hashCode/toString) or because of
> the way generics are implemented.
> Because of erasure, you can have a bridge method alongside the method that
> calls the lambda body,
> but in that case, selecting the method with the most specific return type
> and the less specific parameter types is enough.
>
> Rémi
>
>
> On Thu, Apr 29, 2021, 12:34 Jochen Theodorou <blackd...@gmx.org> wrote:
>
>> On 29.04.21 15:32, Christopher Smith wrote:
>> > Sure, this is theoretically possible (though many functional interfaces
>> > aren't annotated), but the convenience I'm asking about would have to be
>> > compile-time, because it would depend on the declared type (which is
>> > part of why I suspect it might not even make semantic sense in the
>> > underlying dynamic model).
>>
>> why does it have to be compile time only? I don't quite get that. The
>> problem you have to face is of course an Object, which realizes a
>> functional interface, but also has a call method (not part of the
>> interface)
>>
>> bye Jochen
>>
>
>

Reply via email to