XLISP :isnew

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference

# :isa

Type: | - | message selector
Source: | - | xlobj.c

## Syntax

(send object :isa class) - test if object inherits from class
  returns - T if object is an instance of class or a subclass of class, otherwise NIL

## Description

The ':isa' message selector tests if an object inherits from a class.

## Examples

    (setq a-class (send class :new '(state)))   ; create a new class A-CLASS 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

Back to Top

Nyquist / XLISP 2.0 - Contents | Tutorials | Examples | Reference