Details
-
Documentation
-
Status: Open
-
Minor
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Javadocs and online documentation for the Newify AST transform is not quite clear in a couple instances.
1) Online docs http://groovy-lang.org/metaprogramming.html#xform-Newify Ruby-style section could be more clear IMO if the ([Tree,Leaf]) were removed since it only enables the Python-style expressions.
2) Javadoc and online docs do not mention that @Newify can be applied to a local variable declaration, like: @Newify def o = Object.new().
3) The scoping of the transform is pretty clear for the class, method and field/property cases. However for the local variable case, it appears that the transform applies throughout the containing scope of the local variable. That is, I can use the extra constructors anywhere in the block to re-initialize the variable. @Newify def o = Object.new(); ... o = Object.new() .... Is this the intended behavior? My intuition was that the initializer expression was the only place the transform applied, like in the case of a field.