Let's say I have this function:
func abc(i int) (e error) {
defer func() {
if r := recover(); r != nil {
abc(i * 2)
}
}()
if someCondition(i) {
return fmt.Errorf("Some Err");
}
return action() // returns err (nil in case of success) or panics
}
Will this be considered a tail-recursive call? Can it be optimized by the compiler, as tail-recursive calls may be optimized?
I understand that suppressing panic in such a way is not a good decision, but assume there is a correct condition()
function, which is safe and correctly determines when to quit.