Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000359OCamlOCaml generalpublic2001-05-14 15:302001-05-14 19:42
Reporteradministrator 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
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: 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.

TagsNo tags attached.
Attached Files

- Relationships

-  Notes
(0002261)
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.

Cheers,

- Xavier

(0002262)
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


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker