home *** CD-ROM | disk | FTP | other *** search
/ ProfitPress Mega CDROM2 …eeware (MSDOS)(1992)(Eng) / ProfitPress-MegaCDROM2.B6I / PROG / MISC / XLSP21TC.ZIP / XLISP.TXT / __headers__.txt next >
Encoding:
Text File  |  1991-04-14  |  3.4 KB  |  57 lines

  1. components and values.  The components of an instance are:
  2.  
  3.     Class Pointer           This  pointer  shows to which  class the                current object instance  belongs.  It is                through this link that the system  finds                the methods to execute for the  received                messages.
  4.  
  5.     Instance Variables      The Instance  Variables (IVAR) component    and Values        lists what  variables  exist  within the                instance.  The Instance Values component                holds  what the  current  values  of the                variables  are.  Instance  Variables are                used to hold state  information for each                instance.  There  will  be  a  group  of                Instance Variables for each instance.
  6.  
  7.  
  8.  
  9.  
  10. METHODS
  11.  
  12. There have been a few of the messages and methods in XLISP shown to this
  13. point (:NEW and :SHOW).  The following are the methods built into XLISP:
  14.  
  15.     :ANSWER         The  :ANSWER  method  allows  you to  define  or            change methods within a class.
  16.  
  17.     :CLASS         The :CLASS method returns the class of an object.
  18.  
  19.     :ISNEW          The :ISNEW method  causes an instance to run its            initialization  code.  When the :ISNEW method is            run on a class, it resets the class state.  This            allows  you  to  re-define  instance  variables,            class variables, etc.
  20.  
  21.     :NEW            The :NEW method allows you to create an instance            when the :NEW message is sent to a  user-defined            class.  The :NEW  method  allows you to create a            new class (when the :NEW  message is sent to the            built-in CLASS).
  22.  
  23.     :SHOW         The :SHOW method displays the instance or class.
  24.  
  25.  
  26.  
  27. SENDING MESSAGES TO A SUPERCLASS
  28.  
  29. In  addition  to the SEND  function,  there is another  function  called
  30. SEND-SUPER.  The SEND-SUPER  function causes the specified message to be
  31. performed  by the  superclass  method.  This  is a  mechanism  to  allow
  32. chaining of methods in a class hierarchy.  This chaining behavior can be
  33. achieved  by  creating a method  for a class with the  :ANSWER  message.
  34. Within the body of the  method,  you  include a  SEND-SUPER  form.  This
  35. function is allowed only inside the  execution of a method of an object.
  36.  
  37.  
  38. OBJECT AND CLASS
  39.  
  40. The definition of the built-in class OBJECT is:
  41.  
  42.      ________________________________________________________________    |    |    > (send object :show)    |    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>    |________________________________________________________________
  43.  
  44.  
  45. Note that OBJECT is a class - as opposed to an "instance-style"  object.
  46. OBJECT has no superclass, it is the top or root of the class  hierarchy.
  47. OBJECT's class is CLASS.
  48.  
  49.      ________________________________________________________________    |    |    > (send class :show)    |    Object is #<Object: #23fe2>, Class is #<Object: #23fe2>    |      MESSAGES = ((:ANSWER . #<Subr-: #23e48>)     |                (:ISNEW . #<Subr-: #23e84>)     |              (:NEW . #<Subr-: #23ea2>))    |      IVARS = (MESSAGES IVARS CVARS CVALS SUPERCLASS     |           IVARCNT IVARTOTAL)    |      CVARS = NIL    |      CVALS = NIL    |      SUPERCLASS = #<Object: #23fd8>    |      IVARCNT = 7    |      IVARTOTAL = 7    |    #<Object: #23fe2>    |________________________________________________________________
  50.  
  51.  
  52. CLASS has a superclass of OBJECT.  It's class is itself - CLASS. 
  53.  
  54.  
  55.  
  56.  
  57.