Previous Up 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 ocamlbrowser, 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 OCAMLLIB environment variable.

-nolabels
Ignore non-optional labels in types. Labels cannot be used in applications, and parameter order becomes strict.

-oldui
Old multi-window interface. The default is now more like Smalltalk's class browser.

-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.
Most 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 a search window, and the list of modules in the load path. At the top a row of menus.
14.3 Module browsing

You select a module in the leftmost box by either cliking on it or pressing return when it is selected. Fast access is available in all boxes pressing the first few letter of the desired name. Double-clicking / double-return displays the whole signature for the module.

Defined identifiers inside the module are displayed in a box to the right of the previous one. If you click on one, this will either display its contents in another box (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. 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 Up Next