You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 359 Reporter: administrator Status: closed Resolution: not a bug Priority: normal Severity: minor Category: ~DO NOT USE (was: OCaml general)
Adding any function at the BEGINNING of toplevel/toploop.mli makes the top loop
unstable.
E.G.
adding to toplevel/toploop.mli the following after "open Format"
val somefun : unit -> unit
and the foollowing anywhere in toplevel/toploop.ml
let somefun () = ()
then the following toplevel session
# let a = 4;;
>> Fatal error: a unbound at toplevel
Uncaught exception: Misc.Fatal_error.
With other changes to toploop.mli I got core dumps.
If instead somefun is added at the END, all works.
The behaviour is consistent under Sparc and Linux/x86.
The problem does not appear in ocaml 3.00.
The text was updated successfully, but these errors were encountered:
Adding any function at the BEGINNING of toplevel/toploop.mli makes
the top loop unstable.
Correct. This is even "documented" in a comment in toploop.mli:
(* Accessors for the table of toplevel value bindings. These functions
must appear as first and second exported functions in this module.
(See module Translmod.) *)
val getvalue : string -> Obj.t
val setvalue : string -> Obj.t -> unit
The reason is that the code generated for toplevel phrases assume that
"getvalue" is the first field of the tuple representing the Toplevel
module, and "setvalue" is the second one. Yes, it's not pretty, but
that's the kind of meta-level trickery that you can expect from a
toplevel interactive loop...
The problem does not appear in ocaml 3.00.
Right, the handling of toplevel bindings was changed in 3.01 to play
nicer with the GC.
Original bug ID: 359
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)
Bug description
Full_Name: Cristiano Calcagno
Version: ocaml 3.01
OS: Sparc 7 & Linux/x86
Submission from: pc201.dcs.qmw.ac.uk (138.37.88.84)
Adding any function at the BEGINNING of toplevel/toploop.mli makes the top loop
unstable.
E.G.
adding to toplevel/toploop.mli the following after "open Format"
val somefun : unit -> unit
and the foollowing anywhere in toplevel/toploop.ml
let somefun () = ()
then the following toplevel session
# let a = 4;;
>> Fatal error: a unbound at toplevel
Uncaught exception: Misc.Fatal_error.
With other changes to toploop.mli I got core dumps.
If instead somefun is added at the END, all works.
The behaviour is consistent under Sparc and Linux/x86.
The problem does not appear in ocaml 3.00.
The text was updated successfully, but these errors were encountered: