HELP VARIABLES

Andrew Law, August 1987


Introduction

This file describes the different types of variables available in POPLOG. Variables may be constructed by the user or may already exist as part of the system. The variables that are provided by the system are either environment variables (concerned with the behaviour of the operating system and its relation with POPLOG) or POP-11 system variables concerned with the behaviour of various POPLOG facilities (e.g. VED, the tracer, the database etc.). Another class of variables are the ones found in Prolog. Prolog variables behave very differently to POP-11 variables.

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

Contents

Select headings to return to index

------------------------ 2 Environment variables ------------------------

These control POPLOG's relationship with the operating system. See

HELP *INITIAL       - some examples of environment variables, how to
                        set them and how to tailor POPLOG
HELP *INTIALISATION - overview of documentation relating to tailoring
                        POPLOG
DOC  *SYSSPEC       - description of the local directory

POP-11 system variables

Many HELP files describe the value and function of variables associated with individual facilities. In addition, the following provide lists of variables, their function and possible values:

HELP * POPVARS - general POPLOG system variables REF * VEDVARS - variables associated with the control of VED

The *QUERY mechanism can be used to obtain a description of most built-in variables.

The nature of POP-11 identifiers

Variables are a sub set of the set of identifiers:

HELP *IDENTIFIERS - introduction to identifiers.

Variables are a type of identifier. Identifiers can de distinguised according to several characteristics (some of which are discussed here - see REF *IDENT and *HELP IDENTIFIERS for more details):

Variables and constants

Identifiers can be:

variables (multiple assignment) constants (single assignment)

The basic difference is that variables can be assigned to many times, constants can only be assigned to once. See HELP * IDENTIFIERS, *CONSTANT, REF *IDENT for further details.

Lexical and Dynamic scoping

Identifiers can be:

dynamically scoped (permanent) lexically scoped (temporary)

The basic difference between them is that lexical identifiers can be referenced only inside the unit of program text inside which they are declared (i.e. a procedure or a file), and then only while that text is being compiled, whereas permanent identifiers once declared can be referred to anywhere and at any time (unless they cancelled at some point). See REF *IDENT, HELP *LVARS, *LEXICAL, *VARS.

Active variables

There are also active variables. The basic difference between an active and non-active variable is that active variables generalise the notion of a variable with an associated value by allowing the actual value slot in an identifier record to contain not the associated value itself, but rather a procedure that will return that value when called. Thus, when an identifier is declared active, attempting to access its value will cause the procedure found in the value slot to be executed and its result returned; similarily, attempting to assign to the variable will run the updater of that procedure with the new value passed as its argument.

    Moreover, the mechanism is generalised still further by allowing the
'nonactive'  procedure   and  its   updater  to   have  not   just   one
result/argument, but any fixed number of them: this number is called the
'multiplicity' of the active variable.  An access to an active  variable
of multiplicity N  therefore produces  N results, and  a similar  number
must be given when assigning to it.

Active variables are described in more detail in in REF *IDENT and REF *VMCODE, and summarised in HELP * ACTIVE_VARIABLES.

Forms of POP-11 variable declaration

There are several different kinds of permanent and lexical identifiers available in Poplog.

Global or local:
    vars            permanent
    lvars           lexical
    lvars           lexical
    lconstant       lexical constant
    constant        permanent constant
    dlvars          permanent lexical
    dlvars active   permanent lexical active, multiplicity = N
    lvars active:N  lexical active, multiplicity = N
    vars active:N   permanent active, multiplicity = N
Local only:
    dlocal          (neutral as to whether lexical or non-lexical)
    dlocal active:N (active, neutral as to whether lexical or
                     non-lexical)

See documentation below for more details.

Prolog variables

PLOGHELP *SYNTAX/VARIABLES - the syntax of Prolog variables

RELATED DOCUMENTATION

HELP *IDENTIFIERS - introduction to identifiers TEACH *VARS - tutorial introduction to permanent variables HELP *VARS - declaring permanently scoped variables HELP *LEXICAL - the nature of lexically scoped variables HELP *DLOCAL - defining permanent local variables HELP *LVARS - defining lexically scoped variables HELP *CONSTANT - constants HELP *CANCEL - cancelling words HELP *ACTIVE_VARIABLES - active variables

REF *WORDS - details of words in POP-11 REF *POPSYNTAX - details of POP-11 syntax REF *IDENT - technical details of identifiers REF *VMCODE - the POPLOG virtual machine

--- C.all/help/variables ----------------------------------------------- --- Copyright University of Sussex 1987. All rights reserved. ----------