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.

:new

:new

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

SYNTAX

(send <class> :new <args> )
        <class>         -       an existing XLISP class except for 'CLASS'
        <args>          -       the init. args for the new instance 
(send class :new <ivars> [ <cvars> [ <superclass> ] ] )
        <ivars>         -       list of instance variables for new class
        <cvars>         -       list of class variable symbols for new class
        <superclass>    -       superclass for new object 
                                (the default is 'OBJECT')

DESCRIPTION

The :NEW message selector exhibits 2 different behaviors. When you are creating an instance of a class you only need the :NEW message (consisting of the message selector and any data). When you are creating a new class with :NEW, you need to specify instance variables and optionally the class variables and superclass.

EXAMPLES

(setq new-class                         ; create NEW-CLASS with STATE
        (send class :new '(state)))     ;
(setq new-obj (send new-class :new))    ; create NEW-OBJ of NEW-CLASS
(send new-obj :show)                    ; shows the object
(setq sub-class                         ; create SUB-CLASS of NEW-CLASS
        (send class :new '(sub-state)   ;
                         '() new-class));
(send sub-class :show)                  ; show the SUB-CLASS


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