Google
 

Trailing-Edge - PDP-10 Archives - decuslib20-01 - decus/20-0004/performtran.tty
There are no other files named performtran.tty in the archive.
PERFORMTRAN

This file provides a simple extension to the record package that enables
arbitrary operations (not just fetch, replace, create, type?) to be
associated with individual records.  The goal is to permit all aspects of
the behavior of objects of a given type to be centralized completely
within the record declaration.

These operations are specified by providing a list in the tail of a record
declaration whose car is the atom PERFORMOPS and whose cdr is a list
each element of which is of the form (opname params . expressions).
For example, the following record defines a class of objects which always
appear as elements on a global list so that all instances can be
enumerated:

  (RECORD FOO (A B)  (CREATE (CAR (push FOOLIST DATUM)))
	(PERFORMOPS (PRINT (F FILE)
				(PRIN1 "FOO:" FILE)
				(PRIN2 (FETCH A OF F) FILE))
		    (CLEAR NIL (SETQ FOOLIST NIL))
		    (MAP (FN) (MAPC FOOLIST FN]

This declaration also defines operations for printing instances of FOO, 
clearing the global list, and mapping a function through all instances.
These operations can be invoked by the new clispword "perform".  Thus, if
X is bound to a FOO instance,
  (perform FOO.PRINT X T) would print X as a FOO on the terminal,
  (perform FOO.CLEAR) would clear FOO's, and
  (perform FOO.MAP (FUNCTION (LAMBDA (X) (perform FOO.PRINT X T)))) would print
	 all FOO's in their special format.
Code that invoked these perform operations would not have to be modified
if the internal details of the FOO declaration were changed (e.g., to link
FOO's through a field of each object instead of a separate list).  Functions
may have to be recompiled, however, and if the user is working with
masterscope databases, he will be notified of this possibility by the general
need-unsave mechanism.

The translation of a perform form is constructed by retrieving the PERFORMOPS
entry for the (perhaps) qualified name that specifies the operation,
and then substituting the remaining elements of the perform form for the 
corresponding parameter names in the operation definition.

If the indicated operation is not defined for the record, the operation is 
looked up on the global list PERFORMOPS, which can therefore provide a set of
default operations.  This limited mechanism is the only kind of "inheritance" 
currently supported.

Note that unlike SMALLTALK and other approaches to object-oriented
programming, the decoding of the operation is not based on the runtime type of 
a particular argument in the perform form.  Rather, just like ordinary record
operations, the decoding is done when the form is translated or compiled on
the basis only of the static specification in the (qualified) operation
name.

PERFORMTRAN also establishes an interface to Masterscope so that questions like
   . WHO PERFORMS operation
will be answered.

---------
Comments and suggestions to Ron Kaplan (KAPLAN@PARC).