[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ``Update functions'' in POP2.



> Date: Wed, 11 May 88 10:50:47 EDT
> From: Jonathan A Rees <JAR@edu.mit.ai.ai>
> Subject: ``Update functions'' in POP2.

> Someone, I don't remember who, pointed out that the "setter" idea
> (i.e. a function that maps an access procedure (not its name) to a
> corresponding mutator) is not original with T, but was in the language
> POP2. Does anyone know of a reference for this?  Does anyone know how
> this was implemented (global table as in Lyn's message, or local
> association as in T)?

Two recent references are:

     Jonathan Laventhol. Programming in Pop-11.
     Blackwell Scientific Publications, Oxford, 1987.

     Rosalind Barrett, Allan Ramsay, and Aaron Sloman.
     Pop-11: A Practical Language for Artificial Intelligence.
     Ellis Horwood, 1985.

Pop-11 is the descendent of Pop2 that is part of Poplog.

In Pop, every object is of some type or "class".  The class is re-
resented by an object called a "key".  So part of each object is a
pointer to a key.  There is, as one might expect, a "key key" for
key objects, including the key key.  The procedure datakey returns
an object's key.

The key contains a procedure for each of the primitive operations such
as cons(truct), print, equal, and apply.  For each primitive P, there
is a procedure class_P that takes a key and returns the appropriate
procedure.  For example, class_apply of the vector key is a sub-
scripting procedure (subscripting may therefore be written as a
function call.)

Note that the key contains entries only for certain built-in
operations.  You cannot, as far as I know, define new operations
of this sort.  Anyway...

Class_access(i,key) returns an access procedure for the i-th field of
a record class.  Vector classes are similar, except there is only one
accessing procedure.  It takes a subscript as an argument and is
obtained by class_subscr(key).

So we have these access and subscipting procedures.

They, and other procedures, have various fields.  The field of
interest here is the updater.  The procedure updater returns the
updater of a procedure.  It has an updater too, used to assign
the updater of a procedure.

If you do

     set_whatever -> updater(whatever);

where whatever and set_whataver are procedures and -> is assignment
(in the obvious, but unusual, direction) then

     x -> whatever(y).

will put x in the whatever part of y.

There is a symtax for defining updaters.  You say

     define updater whatever(newval, object) ... enddefine;

instead of

     define set_whatever(newval, object) ... endefine;
     set_whatever -> updater(whatever);

You can do the 'define updater' even if the accessing procedure
has not yet been defined, which may put some interesting constraints
on the implementation, but I do not know what the actual
implementation is.

-- Jeff

Jeff Dalton,                      JANET: J.Dalton@uk.ac.ed             
AI Applications Institute,        ARPA:  J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk
Edinburgh University.             UUCP:  ...!ukc!ed.ac.uk!J.Dalton