On 27 May 2014 11:05, Goswin von Brederlow <goswin-v-b@web.de> wrote:
On Tue, May 27, 2014 at 09:42:35AM +0100, Ben Millwood wrote:
> This is essentially why we still have a few Not_found exceptions in Core,
> because it's really pretty hard to know where they might be relied upon, so
> it's easier to leave them in than purge them and risk silent breakage.

HUH?

Say you have a function

val f : ('a, 'b) t -> 'a -> 'b   (raise [Not_found])

then eliminating Not_found that function would become

val f : ('a, 'b) t -> 'a -> 'b option

That should fail to compile if the return type is used or a signature
exists. Where do you think a change would go unnoticed?

MfG
        Goswin

I really mean where we'd like to change Not_found to a more informative or appropriate exception. Sorry, I forgot about one case where we are completely fine with using exceptions: in (usually short-lived) programs where the correct behaviour on error is always to explode apologetically right there and then. The choice of exception is still relevant because it affects the quality of the backtrace and message.