What would be really useful would be something like this:
?- my_caller(an_arg)
false. % Now Sherlock Holmes has to do the work
?- trace_children(my_caller,+fail).
true.
?- my_caller(an_arg).
T Fail: my_callee(some_arg) % Wouldn't this be great? we know where it failed and the args.
false.
I bet we all in this forum have gotten false for an answer and then we have to start digging around
If there are semidet predicates, tracing to fail ports is going to generate a lot of noise. It would be nice to have Prolog validate the det/semidet/etc. notations as part of the debug process. (I mostly use library(rdet), but it lacks support for ensuring no choice points, and I haven’t got around to adding such support.)
You’re right, didn’t think about the noise with multi and semidet preds. What if trace_children/[2,3] by default prints only the last <n> failures (perhaps 3 is a good number) before returning to the top-level? This would eliminate the noise and most likely point to the culprit. What do you think?