I am parsing some lists in a way which uses recursion and looks like it could benefit from TCO, that is it would be the final call in the function when its called. My concern however (this does not seem clear from the docs) is that it might not be the final instruction listed in the call, just the final instruction WHEN its called:
I am concerned with problems along this line:
// given the subsequent line(s), is the following allowed?
if (some-exception) { return @call(.always_tail, clone_list_inner, .{self, cursor, n}) }
// given the existance of the else branch, is the following allowed?
if (next) |n| { return @call(.always_tail, clone_list_inner, .{self, cursor, n}) }
else {
// other code here...
// does this prohibit the above?
}
In all cases when the tail call is called, its the final thing being executed and its returning its value. But its not the final statement, as other brnaches may take it in another direction, and i assume there will be generated IR after it.