Search code examples
ocamlutop

What toplevel directives does utop support?


I can't find any documentation on what toplevel directives I can use in utop. All I could find is this list of directives supported by the default ocaml toplevel, but that list doesn't seem to be complete for utop and is missing things like #typeof, which I know works in utop.


Solution

  • I think it's the only one, that isn't documented. The other ones start with #utop or are documented by #utop_help. (The utop_prompt_* directives should be self-explaining)

    You can list all registered directives with:

    Hashtbl.iter (fun k _v -> print_endline k) Toploop.directive_table 
    

    Third party libraries can also add, remove, or replace macros.