>
> I might be wrong and I might have misunderstood something of importance,
> but it seems to me there is one (and only one) very specific need to use
> *var*: ensuring a code copy/pasted from Java works (with as little number
> of problems as reasonably possible).
>

This is what I understood as well reading the docs, but it looks like `var`
is starting to become a full part of the Groovy syntax because it has been
documented along with `def` as equal to `def` (but only for variable
definitions).


> I would like to use `var` as a return type placeholder meaning "this
> method returns a variable"
>
>
> What does it mean? Far as I know (but of course, my knowledge is limited),
> there's no var-ref type in Java (nor Groovy), and thus no method can return
> a variable. Have I missed something of importance again?
>

You have missed that part in the docs where it says:

> If you think of def and var as an alias of Object, you will understand in
an instant.
So if `var` is an alias for `Object` one should be able to use it as a type
placeholder in method return types as well, but that's not the case

Reply via email to