Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Two questions about Toploop
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2006-02-14 (17:19)
From: Marco Maggesi <maggesi@m...>
Subject: Two questions about Toploop
Hi, I have two questions about Toploop:

  (1) Would be difficult to write a function that builds the list of
      all of all values of a certain type?  E.g. a function

         get_toploop_int : unit -> (string * int) list

      with the behavior

         let a = 2;;
         let b = 3;;
         get_toploop_int ();;
           ==> ["a", 2; "b", 3]

  (2) It seems that the function Toploop.getvalue works only with
      variables defined in the top environment but not in
      (sub)modules.  E.g.

        # Pervasives.exit;;
        - : int -> 'a = <fun>
        # Toploop.getvalue  "Pervasives.exit";;
        >> Fatal error: Pervasives.exit unbound at toplevel
        Exception: Misc.Fatal_error.

      Is it possible to inspect values in the environment relative to
      other modules?