XEROX PERFORMTRAN 2 4 1 PERFROMTRAN 1 4 By: Ron Kaplan (Kaplan.pa@Xerox.com) 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.PA@XEROX). (LIST ((PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC ) STARTINGPAGE# 1) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC )) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL))) (PAGE NIL (PAPERSIZE Letter FOLIOINFO (ARABIC ) STARTINGPAGE# NIL) (0 0 612 792) ((FOLIO NIL (PARALOOKS (QUAD CENTERED) CHARLOOKS (SUPERSCRIPT 0 INVISIBLE OFF SELECTPOINT OFF PROTECTED OFF SIZE 10 FAMILY MODERN OVERLINE OFF STRIKEOUT OFF UNDERLINE OFF EXPANSION REGULAR SLOPE REGULAR WEIGHT MEDIUM INVERTED OFF USERINFO NIL STYLE NIL) FORMATINFO (ARABIC )) (174 36 288 36) NIL) (HEADING NIL (HEADINGTYPE RUNNINGHEAD) (84 744 528 36) NIL) (TEXT NIL NIL (84 96 456 600) NIL)))))(È(È(ŠŠ8(ŠŠ8DÈÈ PAGEHEADING RUNNINGHEAD(È TERMINAL ?1(DEFAULTFONT 1 (GACHA 10) (GACHA 8) (TERMINAL 8)) MODERN MODERN MODERNLOGOMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN  HRULE.GETFNMODERN   HRULE.GETFNMODERN  HRULE.GETFNMODERN &;k9!%!ø(A/Šþ{{: vFzº