I program in Lua, which does to TCO and I've never found it to be an issue with debugging. Now, that could be because of the ways I use TCO---I tend to use it in a recursive routine:
function mainloop()
local packet = receive()
if not packet then
syslog('warning',"error")
return mainloop()
end
process(packet)
return mainloop()
end
(mainly because Lua does not have a 'continue' statement, and this is the best way I've found to handle that) or in state machines:
function state_a(state)
return state_b(state)
end
function state_b(state)
return state_c(state)
end
function state_c(state)
if somecondition()
return 'done'
else
return state_a(state)
end
end
The thing to remember is that a TCO is a form of GOTO. And with GOTO, you have no stack entry, but given that this is a controlled GOTO, I don't see much wrong with it. Do most programmers find TCO that confusing? Or is it the perception that most programmers will find TCO confusing? Have any real studies been done?