English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
Exception Unix_error problem in toplevel
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-02-04 (10:41)
From: ls-ocaml-developer-2006@m...
Subject: Re: [Caml-list] Exception Unix_error problem in toplevel

Bob Williams <a6b37331@telus.net> writes:

> On Sat, Feb 03, 2007 at 02:48:30PM +0100, ls-ocaml-developer-2006@m-e-leypold.de wrote:
>> Bob Williams <a6b37331@telus.net> writes:
>> > Now to the possible bug in toplevel.  According to section 6.8.2 of
>> > the OCaml manual,
>> >
>> > 	exception Unix_error of ...
>> >
>> > simply declares another variant of the built-in variant type "exn".  I
>> > haven't looked into the implementation of OCaml, but I assume the
>> > compiler statically assigns a tag number to every variant of a normal
>> > variant type.  For exn, however, the tag numbers must be assigned at
>> > load time or run time.
>> >
>> > And that is the problem I stumbled over.  The second copy of
>> Oh cool. :-). There should be RAQ (rarely asked questions + obscure
>> problems). This should go into it :-).
>> Regards -- Markus
> They are all obscure, Markus.  A careful developer finds and fixes
> most of the obvious bugs; the ones left over are nearly always
> unusual.
> I did something stupid to trigger the exception-renumbering bug, but

But if I understood it right, it's not a bug, but rather a user
error. There is AFAIR a FAQ for a similar situation if people
interactively load byte code files several times and define functions
in between. Your problem is similar, only that you're not redefining
functions but rather execptions.

I also think redefining an exception should not trigger an error or
warning message.

Rather reloading a byte code file of the same name and at the same
time having still loaded byte code files that refer to another version
of the first byte code file -- this should trigger an error or a
warning. Reloading a byte code file to which no other definitions
refer is not a problem and indeed wanted when you do debugging.

> there are valid circumstances under which the bug could bite somebody
> else.  So it should probably be fixed.

> I know almost nothing about OCaml's implementation, so any patch I
> contribute will probably hurt more than it will help.  But if nobody
> volunteers to fix the bug, I hereby threaten to do it myself.  :)

Regards -- Markus