SWI-Prolog / issues

Dummy repository for issue tracking
8 stars 3 forks source link

documentation for catch/3 suggests discarding choices in scope, contrary to behaviour #121

Closed prologbyexample closed 1 year ago

prologbyexample commented 1 year ago

The documentation for catch(Goal, Exception, Handler) has the following phrase:

all choice points generated by Goal are cut, the system backtracks to the start of catch/3

However, the observed behaviour is that solutions found in the scope of Goal before an exception is thrown remain.

This issue is discussed with an example in this stackoverlflow [question.](all choice points generated by Goal are cut, the system backtracks to the start of catch/3)

Should the documentation be clearer, or have I misunderstood it?

JanWielemaker commented 1 year ago

The docs do not say anything about solutions produced by Goal before the exception. It only says that remaining choicepoints are cut (pruned might be a better term).

I don't think the docs are wrong. Whether they are clear is another matter. Describing these procedural predicates is usually hard. I think that is more something to discuss on the discourse forum. If anyone comes up with a correct and clearer description this will of course be used.