----- Original Message -----
> From: "MG" <mg...@arscreat.com>
> To: "dev" <dev@groovy.apache.org>, "Jochen Theodorou" <blackd...@gmx.org>
> Sent: Monday, November 25, 2024 11:48:54 PM
> Subject: Re: [EXT] Re: Using `var` as method return type placeholder

> Hi Jochen,
> 
> I am so glad that you are finally coming around to adding variable type
> inference to Groovy ||-)
> 
> Here are some links to get anyone started that wants to work on this:
> https://medium.com/javarevisited/local-variable-type-inference-in-java-use-of-var-59beb4f2c764
> https://docs.oracle.com/en/java/javase/17/language/local-variable-type-inference.html
> https://docs.oracle.com/javase/specs/jls/se10/html/jls-18.html
> 
> With var correctly inferring types from its RHS assignment, this can
> finally also be added to final ||-)
> 
> Cheers,
> mg
> 
> PS: I googled a bit, and I could not find in general that ppl think var
> in Java is something you should avoid. Instead, as with any language
> feature, one can over-/abuse it, thereby making code less readable than
> when using explicit types.
> It is funny thinking about this in the context of Groovy, where
> typically ppl who use it as a scripting language do not even use final
> instead of def when defining variables, even though they will never
> reassign said variable 99% of the time... ;-)

There is an official guide that explains some of the gotchas
  https://openjdk.org/projects/amber/guides/lvti-style-guide

regards,
Rémi

> 
> 
> On 25/11/2024 18:51, Jochen Theodorou wrote:
>> Then again... this was Java10, that is already quite a while ago. And in
>> the meantime var got a bit an image of something you should avoid. So
>> maybe it is time for us to decide what we want to do with var in the
> > future as well.

Reply via email to