I think GROOVY-10714 describes the closure to functional interface matching 
issues.  Try offers andThen(Runnable) as well as andThen(Consumer).  Closure 
implements Runnable so it is always the closer match.  We'll need to discuss 
further what changes are safe to make to help such a situation.

________________________________
From: Christopher Smith <[email protected]>
Sent: Thursday, May 21, 2026 8:14 AM
To: [email protected] <[email protected]>
Subject: Re: DO macro and functional programming

For what it's worth, I use Vavr extensively in Groovy applications and think 
its Try support is sufficient. What would be helpful is improvements in the 
inference of Closure signatures, since Vavr sometimes overloads an operation 
name with

For what it's worth, I use Vavr extensively in Groovy applications and think 
its Try support is sufficient. What would be helpful is improvements in the 
inference of Closure signatures, since Vavr sometimes overloads an operation 
name with methods taking different functional interfaces, and the compiler 
makes me explicitly `as` the Closure.

Christopher Smith

On Thu, May 21, 2026, 08:07 Paul King 
<[email protected]<mailto:[email protected]>> wrote:
Hi folks,

I added a GEP-23 and GEP-24.

GEP-23 is for a DO macro and some optional type checkers that can be
used with it.

https://groovy.apache.org/wiki/GEP-23<https://urldefense.com/v3/__https://groovy.apache.org/wiki/GEP-23__;!!GFN0sa3rsbfR8OLyAw!fTzWx7083Axi0avjLzQgVXh5OvWef62dxdpWwLMTTLdGp-pXEKJSTW_gPH5Yqyrw6hZyNBJFshtdRLT6RqAl861Q7riTTZk$>

GEP-24 is a placeholder for Groovy 7 if we ever wanted to provide Try
Monad like support. I suspect it might change a little before we
action it

Some of the design decisions around the type checkers in GEP-23 may
not seem obvious, so I also created a blog post on some of the recent
functional additions (currently including GEP-23 in its proposed
form):

https://groovy.apache.org/blog/groovy6-functional<https://urldefense.com/v3/__https://groovy.apache.org/blog/groovy6-functional__;!!GFN0sa3rsbfR8OLyAw!fTzWx7083Axi0avjLzQgVXh5OvWef62dxdpWwLMTTLdGp-pXEKJSTW_gPH5Yqyrw6hZyNBJFshtdRLT6RqAl861QC76Z2NU$>

Feedback welcome.

Thanks, Paul.

Reply via email to