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.

self

self

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

SYNTAX

self

DESCRIPTION

SELF evaluates to the current object when used within a message context.

EXAMPLES

(setq my-class                          ; create MY-CLASS with STATE
        (send class :new '(state)))     ;
(send my-class :answer :isnew '()       ; set up initialization
        '((setq state nil) SELF))       ;     returning 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 of MY-CLASS
(send my-obj :set-it 5)                 ; STATE is set to 5

CONTEXT: SELF does not exist except within the context of a method and it's execution.

NOTE: In the previous example, there is a SELF in the line that creates the :SET-IT message. What this does is to return the object as the last operation when you do an :ISNEW.


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