diff --git a/step_4.rkt b/step_4.rkt index ea66803ddb41f0e5f495840d2fa6f2fa0c1adec0..e0d095a18193acb89886664db82a6e489497ac20 100644 --- a/step_4.rkt +++ b/step_4.rkt @@ -16,6 +16,8 @@ ; of our inheritance hierarchy. ; Thus, in this case, we do not propagate the set_self! method and instead only dynamically bind the local self_ref value. (define (object) + ; Since object is the root of the hierarchy, it has no super value, here represented as a 'nil value. + (define super 'nil) ; #f is the default value before any binding (define self_ref #f) (define (set-self! ref) (set! self_ref ref)) @@ -99,10 +101,10 @@ ; It will then create the new object, and initiate the dynamic binding of self through ; a 'set-self call. (define (new object-class . class-args) - (let ((temp (apply object-class class-args))) + (let ((new_object (apply object-class class-args))) (begin - (send temp 'set-self! temp) - temp + (send new_object 'set-self! new_object) + new_object ) ) )