On 31-Mar-2000, Keith Wansbrough <[EMAIL PROTECTED]> wrote:
> Sergey writes:
> > [sketch of how to implement better error messages] 
> The problem with this is that there is a performance penalty to be
> paid for overloading a function in this way.
...
> Perhaps this could be turned on with a debugging option
> but in general it would be a Very Bad Thing performance-wise.

Certainly in cases where there is a trade-off between performance
and good error messages, it is appropriate to use a compiler option
to allow the programmer to select what they want.

The Mercury compiler, for example, does exactly this: if you compile without
debugging enabled, then error messages for uncaught exceptions include only
the exception object and its type, whereas if you compile with debugging
enabled then you also get a full stack trace, and furthermore if you then
run the program under the Mercury debugger, then you can also browse
the arguments of any of the calls on the call stack.

While laziness does complicate things significantly, the same kind of thing
would certainly be possible for Haskell too.

-- 
Fergus Henderson <[EMAIL PROTECTED]>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger [EMAIL PROTECTED]        |     -- the last words of T. S. Garp.

Reply via email to