More detailed error messages #2253
Replies: 4 comments 9 replies
-
I agree that errors could be better, by better detecting the error condition (sometimes the error comes from other place) and by giving more descriptive names. However, I think it's interesting to preserve how errors are formulated. Right now, Prolog errors are valid Prolog syntax! Which is a nice property for metaprogramming. Other programming languages generate more verbose errors that may be easier to understand to learners, but that error is challenging to parse by another program. |
Beta Was this translation helpful? Give feedback.
-
I think errors should include file and line information, in addition to details like relevant variable names and values. See #2195 |
Beta Was this translation helpful? Give feedback.
-
Before adding contextual information like file, line number, or the predicate indicator of the intended interface predicate, the catch/3 and throw/1 mechanism needs to be optimized for such use cases. Otherwise code gets cluttered with ad hoc contexts. To a certain degree we have this already, think of the extra last argument in |
Beta Was this translation helpful? Give feedback.
-
One possibility would be to adopt the scheme of IF/Prolog mentioned here. So the second argument of error would be a list of pairs (or a list of equals as IF does). The situation where this came up again was this. It would have helped a lot if the |
Beta Was this translation helpful? Give feedback.
-
I admit I get quite baffled when I see some of the errors reported, but to be fair I spend little time trying to learn myself prolog.
In the roadmap, for Phase 2 consider adding something like
"Detailed Error Reporting for New Prolog Programmers".
I do think participants in an introductory course in programming should be deliverable in prolog (as opposed to java or pascal) but students might need more help in identifying errors (I know I do).
Beta Was this translation helpful? Give feedback.
All reactions