Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Christopher Smith
, 14:03 Remi Forax wrote: > > > -- > > *De: *"Christopher Smith" > *À: *"dev" > *Envoyé: *Jeudi 29 Avril 2021 19:38:27 > *Objet: *Re: () call-type syntax for functional interfaces? > > Also an object implementing multiple

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Remi Forax
> De: "Christopher Smith" > À: "dev" > 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 metho

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Christopher Smith
Also an object implementing multiple functional interfaces. In dynamic mode, you wouldn't know which method to invoke. On Thu, Apr 29, 2021, 12:34 Jochen Theodorou wrote: > On 29.04.21 15:32, Christopher Smith wrote: > > Sure, this is theoretically possible (though many functional interfaces > >

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Jochen Theodorou
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

RE: () call-type syntax for functional interfaces?

2021-04-29 Thread Milles, Eric (TR Technology)
objectExpression. https://issues.apache.org/jira/browse/GROOVY-5881 is a good ticket to look at and see how even the "call" substitution is limited in reality. From: Christopher Smith Sent: Thursday, April 29, 2021 8:33 AM To: dev@groovy.apache.org Subject: Re: () call-type syntax for fu

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Christopher Smith
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

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Rachel Greenham
Sorry if I might be teaching people to suck eggs, but you can discover the functional method of a functional interface through reflection. It’s a bit of a lookup but presumably in groovy the results of such lookups do get cached... I use (reassembled from something that’s a bit more broken up th

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Christopher Smith
That option is not available when using, for example, java.util.function.Function. On Thu, Apr 29, 2021, 03:34 Angelo Schneider wrote: > Is that not already covered by the call() - method? > I mean the option to declare a method called `Object call(args)´ > Best Regards > Angelo > > --- > Angelo

Re: () call-type syntax for functional interfaces?

2021-04-29 Thread Angelo Schneider
Is that not already covered by the call() - method? I mean the option to declare a method called `Object call(args)´ Best Regards Angelo --- Angelo Schneider angelo.schnei...@oomentor.de +49 172 9873893 > Am 29.04.2021 um 02:47 schrieb Christopher Smith : > > It would be convenient to be able to

() call-type syntax for functional interfaces?

2021-04-28 Thread Christopher Smith
It would be convenient to be able to use the convention of "use parentheses on a function-like object" with functional interfaces; for example, if a variable is declared as type Function, to have `myVar(3)` run `myVar.apply(3)`. Is there any chance this would be practical, or would its semantics be