HELP SHOWDEF                                     Robert Duncan, Nov 1987
                                                      Revised April 1990

Displays information about names in the current environment.


    CONTENTS - (Use <ENTER> g to access required sections)

 -- The SHOWDEF command
 -- Using SHOWDEF from VED
 -- Autoloading


-- The SHOWDEF command ------------------------------------------------

The SHOWDEF command displays information about names defined in the
current environment. Like all commands, the syntax of SHOWDEF consists
of the command name followed by a list of arguments:

    showdef <arguments>

Arguments are separated by white space and terminated by a newline: see
HELP * COMMANDS for general information.

The argument list should contain all the identifiers you wish to know
about: for example, the command

    showdef + - * /

will display information about the basic mathematical operators.
Structure pathnames are allowed in arguments to pick out identifiers
which are not globally defined:

    showdef Memory.hilim Memory.lolim

If no arguments are given, SHOWDEF will display all the names in the
current environment: this can be a long list!

Arguments can be optionally interspersed with declaration keywords drawn
from the following list:

    functor
    signature
    structure
    type
    exception
    con
    val

Keywords have the effect of qualifying any following identifiers up to
the next keyword so that SHOWDEF will report only on occurrences of the
identifiers within that particular declaration class. The class "type"
stands for all types - datatypes, abstract types and type abbreviations,
while the class "val" includes exception and data constructors. In the
standard environment, the command:

    showdef Real

will report information on three names: a signature, a structure and an
exception. The command

    showdef exception Real

will limit the display to the exception only. The command:

    showdef structure Array val Array.array

will report on the library structure -Array- and then on the value
-array- defined within that structure.

A keyword on its own stands for all identifiers of that particular
class: try

    showdef exception

to find the names of all exceptions.

The information printed by SHOWDEF is basically the same as that
produced by the top-level when a name is first defined. For certain
identifier classes however, extra information is given: for structures
and functors this includes any associated signatures; for datatypes it
includes their constructors, and for infix identifiers their precedence
and associativity. This is demonstrated with the command

    showdef list

which produces output something like:

    datatype 'a list

    infixr 5 ::
    con op :: : 'a * 'a list -> 'a list
    con nil : 'a list

Ouput is sorted first by declaration class, and then alphabetically
within the classes.


-- Using SHOWDEF from VED ---------------------------------------------

You can also call SHOWDEF from VED. Doing

    <ENTER> showdef

with or without arguments will produce exactly the same output as the
top-level command, but in this case the output is directed to a
temporary VED buffer.

This is particularly useful when editing ML programs, as you can find
out the type of a variable or examine a signature without having to
leave the current file. The quickest way of doing this is in conjunction
with the VEDEXPAND facility (described in HELP * VEDEXPAND). You can
enable this by putting in your "vedinit.p" file the line:

    `^` -> vedexpandchar;

Thereafter, the two-character sequence ^w entered on the VED command
line will automatically be replaced by the word to the right of the
current cursor position in the file. So if the cursor is placed on the
first character of an identifier in a program, doing

    <ENTER> showdef ^w

will report any information known about that name.


-- Autoloading --------------------------------------------------------

SHOWDEF won't necessarily autoload library files to find definitions of
modules not currently defined. For example, in the standard environment
the structure -Array- is an autoloadable library, and the command

    showdef Array

will produce the response

    No definitions for Array
    Nothing to show

You can force autoloading to occur by making clear that it's a module
name you're after: this can be done either with a qualifying keyword, or
by using a structure name as part of a long identifier. Either of the
commands

    showdef structure Array

    showdef Array.array

will cause the Array module to be autoloaded.


--- C.all/pml/help/showdef
--- Copyright University of Sussex 1991. All rights reserved. ----------
