ocamlutop

use fully qualified names in utop


I want to launch utop in a directory containing a.ml (which has a definition for something) and be able to enter A.something in utop. I know I can do #use "a.ml", but that pollutes the global namespace. How can I make the fully qualified name A.something work in utop?


Solution

  • According to #help:

    #mod_use <str>
      Usage is identical to #use but #mod_use wraps the contents in a module.
    

    So #mod_use "a.ml" should do it.