JScript or Groovy syntax for swapping variables

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.

Swapping variables is shown as one of the main Idioms in the Kotlin documentation. https://kotlinlang.org/docs/reference/idioms.html

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.

May be the real question is; why there is no multiple assignment in Kotlin?

No, it is not. There is huge amount of bad practices in Python, JavaScript, Scala and even Java. It is not a reason to pull them into Kotlin.

May be you are right, but you can misuse any language feature so and so. Is this the real reason why this feature is not present in the language?

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.

I agree. From my perspective it does not overcome the minus 100 points that any feature starts with.

I thought maybe this destructuring would work:

var a = 1
var b = 2
(a, b) = Pair(b, a)

Since it works in Swift and the following works in Kotlin:

val (a2, b2) = Pair(b, a)

But I guess not.