Received: from leopard.cs.byu.edu (leopard.cs.byu.edu [128.187.2.182]) by ra.abo.fi (8.6.10/8.6.10) with ESMTP id OAA15720; Tue, 7 Nov 1995 14:06:17 +0200
Received: by leopard.cs.byu.edu
	(1.37.109.15/16.2) id AA262156997; Tue, 7 Nov 1995 02:36:37 -0700
Sender: info-hol-request@leopard.cs.byu.edu
Errors-To: info-hol-request@leopard.cs.byu.edu
Precedence: list
Received: from relay2.pipex.net by leopard.cs.byu.edu with SMTP
	(1.37.109.15/16.2) id AA262126987; Tue, 7 Nov 1995 02:36:27 -0700
Received: from Q.icl.co.uk by bath.pipex.net with SMTP (PP);
          Tue, 7 Nov 1995 09:36:05 +0000
Received: from norman.win.icl.co.uk ([145.227.116.1]) by Q.icl.co.uk (4.1/icl-2.12-server)
	id AA00782; Tue, 7 Nov 95 09:35:26 GMT
From: Rob Arthan <rda@win.icl.co.uk>
Date: Tue, 7 Nov 95 09:34:56 GMT
Message-Id: <9511070934.9340.0@win.icl.co.uk>
To: info-hol@leopard.cs.byu.edu, reetz@ira.uka.de
Subject: Re:  better error messages in hol90?

Ralf Reetz would like to see more informative error messages:

> ...  I found it very useful to write error messages,
> which included the term like
> 
> raise HOL_ERROR
> {origin_structure = "bla",
>  origin_function  = "f",
>  message          =
>  "f fails because subterm "^(term_to_string t)^" is blablabla"};

When designing ProofPower, we found that so many of the proof
procedures one wants work by repetition until failure or failure-driven
case selection that using the above approach throughout the system has
a bad effect on performance (because the pretty printer is being
invoked many times to format messages which are never actually seen).
Unfortunately, it is good for usability to make all error messages as
helpful as you can. The ProofPower solution is to defer evaluation of
the slow part, as if HOL_ERROR were defined so you can write:

raise HOL_ERROR
{origin_structure = "bla",
 origin_function  = "f",
 message          = (fn () =>
 "f fails because subterm "^(term_to_string t)^" is blablabla")};

Of course, you then need to arrange things so that if the exception
ever does get to the top level, the user can see the message.
This is fairly easy if you are able to adjust the ML pretty-printer
to print the operand of HOL_ERROR in a custom format.

Rob Arthan.

