At the end of the day all that underlines my point, that type inference would mostly be beneficial in certain, easy to grasp cases (eg to make boilerplate code more concise). It will be interesting to see what applications Daniel has in mind... Cheers,mg
PS: Related question: What about return type inference in Groovy closures - or LINQ support ? -------- Ursprüngliche Nachricht --------Von: Jochen Theodorou <blackd...@gmx.org> Datum: 07.09.18 09:03 (GMT+01:00) An: MG <mg...@arscreat.com>, dev@groovy.apache.org Betreff: Re: About type inference of method return value On 06.09.2018 20:51, MG wrote: [..] > The "int to long" inference example is an interesting special case that > I think would need to be discussed*: We could either reject these case > (throw CTE) - or maybe inferring to a higher up super type (Number in > the extreme case) could sort of work... > But due to inherently involved performance/precision issues, in my > opinion inferring number types does not seem like a good idea... I could have made the example differently and let it return a different "incompatible, but fitting" type. You should not get too hang up on the specific types in use, but look more at the secondary effects the change has bye Jochen