Tom,
return -code return just unwinds two levels rather than one.
You can see the difference with this small example:
proc IamTheTop {} {
puts "Starting"
catch { a } errMsg
puts "Finishing $errMsg"
}
proc a {} {
puts "to b"
b
puts "from b"
}
proc b {} {
puts "to c"
c
puts "from c"
}
proc c {} {
puts "return -code return"
return -code return
}
which should produce:
Starting
to b
to c
return -code return
from b
Finishing
You can see that function "a" picked up processing
which might be what you want but in most places I see
return -code return it probably is not what people
expect. changing the above to
return -code error
yields
Starting
to b
to c
return -code error
Finishing
You generally will not get in trouble with return -code return
in a .tcl/.adp page but it can definitely be a problem in
library calls and in some of the code blocks like on_error
where the return codes are not necessarily all handled correctly.