On 11/26/26 13:56, Paul King wrote:
[...]
GEP-33: Functional Literals for Type-Parameter Slots
GEP-34: Native Functional Values
GEP-35: Call Syntax on Functional Values

I plan to roll back just a few items for 6.0.1 related to those topics
where the inconsistencies and crashes occurred. PRs targeting
GROOVY_6_0_X reflect what I propose. We can potentially bring more of
them across for 6.0.2 if we find the right solution. I am trying to
avoid folks having to flip to a new 6 semantics and then flip to
something different (or flip back) for 7.[...]

Hi Paul... after looking at those I see some potential problems.

so assume we have

interface StringTransform {
  String transform(String)
}

class Uppercase implements StringTransform {
  String transform(String x){x.toUppercase()}
  int getID(){1}
}

obviously I can do

StringTransform  myTransform = new Uppercase()
myTransform.getID()
myTransform.transform("foo")

And the proposal seems to suggest that if we allow this:

StringTransform myTransform = { it.toUppercase() }
myTransform.transform("foo")
myTransform.call("foo")

but what is with:

myTransform.call(1)

How do we prevent this? And even if we say that we will carry a virtual flow type for this that keeps the information, we loose that information as soon as we leave the context. A return myTransform in a method that returns Closure<String> for example sill does not define what argument types are legal for call(Object).

There is much more in there, but I have the feeling this a pretty central aspect for the goal

bye Jochen



Reply via email to