Path: utzoo!attcan!uunet!mcsun!ub4b!kulcs!habakuk.cs.kuleuven.ac.be From: bimbart@habakuk.cs.kuleuven.ac.be (Bart Demoen) Newsgroups: comp.lang.prolog Subject: error handling (was about arg/3) Message-ID: <1328@n_kulcscs.kuleuven.ac.be> Date: 23 Oct 90 00:17:37 GMT Sender: news@cs.kuleuven.ac.be Organization: Dept. of Computer Science (K.U.Leuven) Lines: 45 Originator: bimbart@hera Following the discussion on arg/3 ... As people might know, the current draft standard for Prolog specifies under which circumstances a call to a predicate is in error and what has to happen then. Error messages were considered too environmental and so are not included in the current draft. But still, some error recovery is currently proposed: a goal in error must give rise to a replacement of the goal by a call to the builtin predicate exit_block/1 with as argument the term error(A,B) where A is an atom identifying the type of error (defined by the standard), and B being implementation defined. This seems not common practice: common practice seems to be give error message and then fail or enter debugger. Also, the current draft seems miles away from (one of) the design principle(s) by R. O'Keefe. I once proposed the following to ISO - but it was turned down (without voting if I remember well) The standard should specify how a builtin predicate can be called 'correctly' and the effect of such calls (most 'correct' calls succeed, but there is nothing against deciding that calling arg/3 with a negative first argument is not an error and defining the behaviour as fail) ALL other calls should silently fail if debug is off (the behavior of a Prolog system when debug is on, is not standardized) This is sensible for running applications - they typically have debug off ... This is sensible for optimising compilers and for program analysis. This is close to current practice (in some systems messages can be turned off, so that only failure remains) You can have error messages in debug mode - the only mode they make sense in. Another proposal is: let there be a warn_on and warn_off mode; the standard should then require in warn_on, all erroneous calls to builtin predicates must be reported and also fail in warn_off, all erroneous calls to builtin predicates only fail Perhaps there should be 3th mode in which the exit_block/1 mechanism is used. How do people feel about this ? Bart Demoen