groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: About supporting `var` of Java10+
Date Thu, 08 Mar 2018 22:42:54 GMT
So in that one aspect of "assigning a value later on" your expectation is
exactly like Java's "var" and Groovy's current "def"?


On Thu, Mar 8, 2018 at 11:58 PM, mg <mgbiz@arscreat.com> wrote:

> My argument was not in relation to the JEP, but a Groovy user story, in
> relation to you saying, that I would not see a difference between def and
> var, apart from when assigning a value later on.
>
> But assigning a value later on is _exactly_ what I am going to do when I
> use var - because otherwise I would use final instead of var...
>
> -------- Urspr√ľngliche Nachricht --------
> Von: Jochen Theodorou <blackdrag@gmx.org>
> Datum: 08.03.18 13:32 (GMT+01:00)
> An: dev@groovy.apache.org
> Betreff: Re: About supporting `var` of Java10+
>
>
>
> Am 08.03.2018 um 12:45 schrieb mg:
> > Maybe I am missing your point, but what I meant was: When I use
> >
> > var x = new Foo()
> >
> > I indicate that x will be reassigned further down in the scope,
> > otherwise I use
> >
> > final x = new Foo()
>
> That's what I understood. But the later variant is not part of the JEP.
> In Groovy what you wrote is an alias for final Object x = new Foo()
>
> bye Jochen
>

Mime
View raw message