Possible Duplicate:
Tuple parameter declaration and assignment oddity
Here's a stupid little function:
def foo() {
var v1 = 0
var v2 = 50
do {
var (v1, v2) = someSillyFunction(v1, v2)
} while(v1 < v2)
}
def someSillyFunction(v1: Int, v2: Int) = (v1+1, v2-1)
Trouble is I'm getting an error "recursive value $x5 needs type" on var (v1, v2). Now, I don't really want to do even what this code is suggesting, as I don't want to -- within the do-block -- declare the new vars v1 and v2. I'd just like to reassign the existing vars. However, trying "(v1, v2) = someSillyFunction(v1, v2)" does me no better. I get '; expected but = found'.
I can always do:
val (f, g) = someSillyFunction(v1, v2)
v1 = f
v2 = g
But that's mighty ugly and I didn't know if there was a better way of reassigning with destructuring.