I agree Closure cannot be replaced/emulated completely. And Function is not universally applicable either. But the universe of SAM types is much bigger than Function alone.
Your proposed syntax does not appear to cover much more than Function would. And it would introduce a lot of effort for reader and tool builder as well. Groovy/Java developer already has to be aware of closure literal and lambda literal syntax. Your proposal adds a third possibility when reader encounters "->" in source. My general point is that there are a number of options that are available today. Most can also be used by Java or Kotlin code that offers some Groovy support/interop. Groovy-only syntax is not as widely applicable and would not be available for some time. My opinion is that there is little benefit to the new syntax and a lot of potential cost. ________________________________ From: Daniel.Sun <sun...@apache.org> Sent: Wednesday, February 13, 2019 8:07 AM To: d...@groovy.incubator.apache.org Subject: Re: About polish the generics type syntax for closure Thanks for your suggestion. If the argument type is Function and the parameter type is Closure, implicit coerce will happen, thus the performance will be impacted somehow. Certainly we can use native lambda to avoid the performance issue. In addition, Function accepts only one parameter, a bit limited for general scenarios. In short, Closure can not be replaced completely. Cheers, Daniel.Sun ----- Apache Groovy committer Blog: https://urldefense.proofpoint.com/v2/url?u=http-3A__blog.sunlan.me&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=OEzRyWh0ecDlHuHykn040knCc4zWHNNZDEWY-2anHm8&s=UpwOkqNP45mAdUSjnCO-aR_PyQrVLRKFSrEyUIQSqRY&e= Twitter: @daniel_sun -- Sent from: https://urldefense.proofpoint.com/v2/url?u=http-3A__groovy.329449.n5.nabble.com_Groovy-2DDev-2Df372993.html&d=DwICAg&c=4ZIZThykDLcoWk-GVjSLmy8-1Cr1I4FWIvbLFebwKgY&r=tPJuIuL_GkTEazjQW7vvl7mNWVGXn3yJD5LGBHYYHww&m=OEzRyWh0ecDlHuHykn040knCc4zWHNNZDEWY-2anHm8&s=YwSwy0HdBm2CKcJaoqan8AoB-csth7-8vS6qutDbwt0&e=