Search                        Top                                  Index
HELP PREFIX                                     Steven Hardy, March 1982

************************************************************************

  Note: This library is now considered obsolete, and has been moved to
  *popobsoletelib. If you want to try loading it do:

    lib popobsoletelib;
    lib prefix;

************************************************************************

The syntax word prefix is used to protect against variable clashes.
Designated words in the program text follwing a prefix statement are
replaced by 'prefixed' versions of the same word. For example, after the
statement:

    prefix foo x y z;

all occurences of x are replaced by foo_x, those of y by foo_y and those
of z by foo_z. This systematic replacement continues until an endprefix
statement is encountered or until the end of file if the prefix
statement is in a file.

For example:

    "x" =>
    ** x
    prefix foo x;
    "x" =>
    ** foo_x
    endprefix
    "x" =>
    ** x

Files containing prefix statements typically take about twice as long to
compile.

prefix statements should not (for the moment) be nested.

prefix is implemented with a recursive call of the compiler (using
popval). For this reason, prefix statements can occur only at execute
level and not, for example, within procedure defintions. That is:

    define foo();
        prefix baz x;
            x =>
        endprefix
    enddefine;

is not permitted, whilst the following is permitted:

    prefix baz x;
        define foo();
            x =>
        enddefine
    endprefix

This mechanism has been superseded by the more versatile section
facility of Pop-11. See HELP * SECTIONS for details. However the prefix
library file may have some tutorial value. It can be inspected with the
editor command:

        <ENTER> showlib prefix


--- C.all/help/prefix
--- Copyright University of Sussex 1995. All rights reserved.