Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.6.3
-
None
-
None
Description
Consider this simple test:
def f()
{ [1, 2] }class X
{ def a def b }// OK
def (int a, int b) = f()
def (aok, bok) = f()
// error: expecting ')', found ',' at line: 16, column: 5
def x = new X()
(x.a, x.b) = f()
(x.@a, x.@b) = f()
println "$x.a, $x.b"
I found this error surprising...I would like to see fields/arrays/etc. (general lvalues) supported.
The current "Multiple simple variable initialisation" facility leads to surprise and cumbersome code, as in what got me fired up:
def (int centerX, int centerY) = findCenter(model.boundingPolygon)
model.boundingPolygonCenterX = centerX
model.boundingPolygonCenterY = centerY
Strikes ME as being appropriate for 1.7...