;; There is only very little real code in this file. ;; Most is just droped templates. However, see the last part of the file! (drop '(define (a-metaclass) (let ((self nil) (super (meta-super-class instantiation))) ??? ;; class variables (let ((class-variable init-value) ...) ;; class methods (define (class-method formal-parameters...) body) ... (define (instance-description) (let ((super (new-part super-class)) (self nil)) (let ((instance-variable init-value) ...) (define (instance-method formal-parameter...) body) ... (define (inner-dispatch m) (cond ((eq? m 'selector) method) ... (else (method-lookup super m)))) (set! self inner-dispatch) self))) (define (outer-dispatch m) (cond ((eq? m 'instantiator) instance-description) ((eq? m 'selector method) ... (else (method-lookup super m))))) (set! self outer-dispatch)) (virtual-operations self) ??? fjernes ??? self)) ) (drop '(define a-class (let ((self ...) (super ...)) (let ((class-variable init-value) ...) ...) self)) ) (drop '(define (object-class-temporary) (let ((self ()) ;; assigned at the bottom of this class (super ())) ;; assigned via the method fix-super (define (fix-super) (set! super (class-class)) (virtual-operations self) 'done) (define (instance-description) (let ((self ()) ;; assigned at the bottom of this class (super ()) ;; empty list because root of hierarchy ...))) ... (set! self outer-dispatch) self)) ) (drop '(define (class-class) (let ((self ()) ;; assiged a the bottom of this class (super (new-part object))) (let ((instances () )) ;; a list of instances (define (new) ) ; described in section ??? ... ;; This class is an abstract class. ;; I.e., there is no instance-description defined. ... (set! self outer-dispatch)) (virtual-operations self) ??? self)) ) (drop '( (define object (new-instance object-class-temporary)) (send object 'fix-super) (virtual-operations object) )) (drop '(define (object-class) (let ((oc (new-class-part object-class-temporary))) (send oc 'fix-super) oc))) (drop '(define (new) (let ((instance (new-instance (method-lookup self 'instantiator)))) (set! instances (cons instance instances)) instance))) (define (new-instance-part class) ;; Used to instantiate new parts of objects. ;; return an instance of class, regarded as a part of an object. ;; use (send class 'new) for instantiation of a "whole" object. (let ((instantiator (method-lookup class 'instantiator))) ; every class must respond to the instantiator message. (instantiator)))