Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000359OCaml~DO NOT USE (was: OCaml general)public2001-05-14 15:302001-05-14 19:42
Assigned To 
StatusclosedResolutionno change required 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0000359: toplevel/toploop.mli fragile
DescriptionFull_Name: Cristiano Calcagno
Version: ocaml 3.01
OS: Sparc 7 & Linux/x86
Submission from: (

Adding any function at the BEGINNING of toplevel/toploop.mli makes the top loop
  adding to toplevel/toploop.mli the following after "open Format"
    val somefun : unit -> unit
  and the foollowing anywhere in toplevel/
    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.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
administrator (administrator)
2001-05-14 19:17

Hi Cristiano,

> 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.


- Xavier

administrator (administrator)
2001-05-14 19:42

It's a documented bug :-)

- Issue History
Date Modified Username Field Change
2005-11-18 10:13 administrator New Issue
2017-02-23 16:36 doligez Category OCaml general => -OCaml general
2017-03-03 17:55 doligez Category -OCaml general => -(deprecated) general
2017-03-03 18:01 doligez Category -(deprecated) general => ~deprecated (was: OCaml general)
2017-03-06 17:04 doligez Category ~deprecated (was: OCaml general) => ~DO NOT USE (was: OCaml general)

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker