Previous Contents Next
Chapter 14 The browser/editor (ocamlbrowser)

This chapter describes OCamlBrowser, a source and compiled interface browser, written using LablTk. This is a useful companion to the programmer.

Its functions are:
14.1 Invocation

The browser is started by the command ocamlrowser, as follows:
        ocamlbrowser options
The following command-line options are recognized by ocamlbrowser.

-I directory
Add the given directory to the list of directories searched for source and compiled files. By default, only the standard library directory is searched. The standard library can also be changed by setting the CAMLLIB environment variable.

-labels
Switch to the commuting label mode of compilation, meaning that labeling rules are applied strictly, and commutation between arguments is allowed. (See section 2.1.4.)

-rectypes
Allow arbitrary recursive types during type-checking. By default, only recursive types where the recursion goes through an object type are supported.

-w warning-list
Enable or disable warnings according to the argument warning-list.
All options can also be modified inside the application by the Modules - Path editor and Compiler - Preferences commands. They are inherited when you start a toplevel shell.

14.2 Viewer
This is the first window you get when you start OCamlBrowser. It displays the list of modules in the load path. Click on one to start your trip.

14.3 Module walking

Each module is displayed in its own window.

At the top, a scrollable list of the defined identifiers. If you click on one, this will either create a new window (if this is a sub-module) or display the signature for this identifier below.

Signatures are clickable. Double clicking with the left mouse button on an identifier in a signature brings you to its signature, inside its module box.

A single click on the right button pops up a menu displaying the type declaration for the selected identifier. Its title, when selectable, also brings you to its signature.

At the bottom, a series of buttons, depending on the context. Control-S lets you search a string in the signature.

14.4 File editor
You can edit files with it, if you're not yet used to emacs. Otherwise you can use it as a browser, making occasional corrections.

The Edit menu contains commands for jump (C-g), search (C-s), and sending the current phrase (or selection if some text is selected) to a sub-shell (M-x). For this last option, you may choose the shell via a dialog.

Essential functions are in the Compiler menu.

14.5 Shell
When you create a shell, a dialog is presented to you, letting you choose which command you want to run, and the title of the shell (to choose it in the Editor).

The executed subshell is given the current load path.


1
To avoid combinatorial explosion of the search space, optional arguments in the actual type are ignored in the actual if (1) there are too many of them, and (2) they do not appear explicitly in the pattern.

Previous Contents Next