In my case both contain an integer, but I agree: code should not
contain a trap like that. In Python you can do:
a, b = b, a
I like that very much, but every language gas his pros and cons.
When I execute:
set timeCount 10000000
time {lassign [list $a $b] b a} $timeCount
time {set _tmp $a ; set a $b ; set b $_tmp ; unset _tmp} $timeCount
I see that the lassign version is a little more efficient. That takes
0.6074245 microseconds per iteration, while the swap version takes
0.7931169 microseconds per iteration. So I go for the correct lassign
version.