send


; Send a message to an object.
; The selector of the message is quoted.
; A send is  (send object 'selector)

(define *sendcons* (cons #f #f))

(define (send object selector . args) (let ((objclass (class object)) (methods '()) (pair '()) (method #f)) (if objclass (begin (set! methods (assoc objclass *methods*)) (set! pair (assoc selector (cdr methods))) (if pair (begin ; = (cons object args) (set-car! *sendcons* object) (set-cdr! *sendcons* args) (apply (eval (cadr pair)) *sendcons*)) (error "Undefined method for object:" object selector)) ) (error "Unknown class for object:" object)) ))

Contents    Page-10    Prev    Next    Page+10    Index