Skip to content
Extraits de code Groupes Projets
Valider 71e5239e rédigé par Nicolas Verbois's avatar Nicolas Verbois
Parcourir les fichiers

Update step_4.rkt

parent a363dcd2
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -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
)
)
)
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter