Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

object

object

type: object 
location: built-in
source file: xlobj.c
Common LISP compatible: no
supported on: all machines

SYNTAX

object

DESCRIPTION

OBJECT is an object class. An object is a composite structure that contains internal state information, methods (which respond to messages), a pointer to the object's class and a pointer to the object's super-class. XLISP contains two built in objects: OBJECT and CLASS. OBJECT is the superclass for the CLASS object.

EXAMPLES

(send object :show)                     ; look at the object definition
                                        ;
                                        ; example use of objects
(setq my-class                          ; new class MY-CLASS with STATE
        (send class :new '(state)))     ;
(send my-class :answer :isnew '()       ; set up initialization
        '((setq state nil) self))       ;
(send my-class :answer :set-it '(value) ; create :SET-IT message
        '((setq state value)))          ;
(setq my-obj (send my-class :new))      ; create MY-OBJ out of MY-CLASS
(send my-obj :set-it 5)                 ; STATE is set to 5

OBJECT DEFINITION: The internal definition of the OBJECT object instance is:

Object is #<Object: #23fd8>, Class is #<Object: #23fe2>
  MESSAGES = ((:SHOW . #<Subr-: #23db2>) 
              (:CLASS . #<Subr-: #23dee>) 
              (:ISNEW . #<Subr-: #23e2a>))
  IVARS = NIL
  CVARS = NIL
  CVALS = NIL
  SUPERCLASS = NIL
  IVARCNT = 0
  IVARTOTAL = 0
#<Object: #23fd8>

The class of OBJECT is CLASS. There is no superclass of OBJECT. Remember that the location information (like #23fd8) varies from system to system, yours will probably look different.

BUILT-IN METHODS: The built in methods in XLISP include:

<message>       operation
-------------------------------------------------------
:ANSWER         Add a method to an object.
:CLASS          Return the object's class.
:ISNEW          Run initialization code on object.
:NEW            Create a new object (instance or class).
:SHOW           Show the internal state of the object.

MESSAGE STRUCTURE: The normal XLISP convention for a <message> is to have a valid symbol preceeded by a colon like :ISNEW or :MY-MESSAGE. However, it is possible to define a <message> that is a symbol without a colon, but this makes the code less readable.


Go to the first, previous, next, last section, table of contents.