Now to swap variables you have to do something like this:
var a = 1
var b = 2
var c = 3
println("$a $b $c")
a = c.also { c=b.also { b = a } }
println("$a $b $c")
which is not bad, but JScript and groovy ones are far better:
[a, b, c] = [c, a, b] - JScript
(a, b, c) = [c, a, b] - Groovy
May be this is a more general question of a variable multiple assignments?
But I generally want to show something to my JScript colleagues, which they do not have in their arsenal and by now they always shoot at me back with something better.
Do you have real example, where you need to swap variables? I can’t imagine a case, where it is not a consequence of bad design. Also, you example shows a clear abuse of also.
I think, that the fact that other languages (one of which is JVM based) are implementing this functionality, is more than enough proof, that there is a reason to do so and there is no reason for me trying to convince anyone.
It is hard to say, what happens in heads of language committee, buy I assume that they do not see added value in it. I personally still do not see, where it could be massively applied.