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.

:isnew

:isnew

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

SYNTAX

(send <object> :isnew <args> )
        <object>        -       an existing object
        <args>          -       the arguments to be passed to the init. code
(send <class> :isnew <ivars> [ <cvars> [ <superclass> ] ] )
        <class>         -       an existing XLISP class
        <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 :ISNEW message selector causes an instance to run its initialization method. If an :ISNEW message is sent to a class, the class definition and state will be reset as specified in the arguments of the message.

EXAMPLES

(setq a-class                           ; create a new class A-CLASS 
        (send class :new '(state)))     ;        with STATE
(send a-class :answer :isnew '()        ; set up initialization
        '((setq state nil) self))       ;
(send a-class :answer :set-it '(value)  ; create :SET-IT message
        '((setq state value)))          ;
(setq an-obj (send a-class :new))       ; create AN-OBJ out of A-CLASS
(send an-obj :show)                     ; returns object - STATE = NIL
(send an-obj :set-it 5)                 ; STATE is set to 5
(send an-obj :show)                     ; returns object - STATE = 5
(SEND an-obj :ISNEW)                    ; re-initialize AN-OBJ
(send an-obj :show)                     ; returns object - STATE = NIL


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