From 168629c99ae7d95118a49ffab5acf64f29f4efeb Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Tue, 15 Apr 2003 01:15:06 +0000 Subject: [PATCH] * goops.scm (compute-getter-method): For custom getter: Check boundness even if there is an init-thunk. (The getter can return # even if the slot has been set before.) * goops.c (scm_sys_fast_slot_ref): Use SCM_SLOT instead of scm_at_assert_bound_ref. (We don't want the unbound check. See oop/goops/active-slot.scm.) --- NEWS | 11 +++++++++++ libguile/ChangeLog | 6 ++++++ libguile/goops.c | 2 +- oop/ChangeLog | 6 ++++++ oop/goops.scm | 13 ++++++++----- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 450698ace..ea9a4fc3a 100644 --- a/NEWS +++ b/NEWS @@ -44,7 +44,18 @@ correctly. The class layout slot, which informs the GC about which slots to GC protect, is now initialized correctly. +** GOOPS class redefinition bug fixed. + +The class redefinition protocol now properly removes the old accessor +methods from their accessors. + * Changes to Scheme functions and syntax + +** %fast-slot-ref no longer checks slot boundness + +This makes the metaclass in (oop goops active-slot) +working again. + * Changes to the C interface diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 4bed0d194..21ce7a27a 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,9 @@ +2003-04-15 Mikael Djurfeldt + + * goops.c (scm_sys_fast_slot_ref): Use SCM_SLOT instead of + scm_at_assert_bound_ref. (We don't want the unbound check. See + oop/goops/active-slot.scm.) + 2003-04-14 Mikael Djurfeldt * print.c (scm_prin1): Remember old state of pstate->writingp. diff --git a/libguile/goops.c b/libguile/goops.c index 5ef1e2d22..223b766f8 100644 --- a/libguile/goops.c +++ b/libguile/goops.c @@ -1066,7 +1066,7 @@ SCM_DEFINE (scm_sys_fast_slot_ref, "%fast-slot-ref", 2, 0, 0, i = SCM_INUM (index); SCM_ASSERT_RANGE (2, index, i >= 0 && i < SCM_NUMBER_OF_SLOTS (obj)); - return scm_at_assert_bound_ref (obj, index); + return SCM_SLOT (obj, i); } #undef FUNC_NAME diff --git a/oop/ChangeLog b/oop/ChangeLog index 325c8206f..ac99ef445 100644 --- a/oop/ChangeLog +++ b/oop/ChangeLog @@ -1,3 +1,9 @@ +2003-04-15 Mikael Djurfeldt + + * goops.scm (compute-getter-method): For custom getter: Check + boundness even if there is an init-thunk. (The getter can return + # even if the slot has been set before.) + 2003-04-13 Mikael Djurfeldt * goops.scm (compute-getters-n-setters/verify-accessors): Better diff --git a/oop/goops.scm b/oop/goops.scm index 531655cca..743985a42 100644 --- a/oop/goops.scm +++ b/oop/goops.scm @@ -909,7 +909,13 @@ (define-method (remove-class-accessors! (c )) (for-each (lambda (m) (if (is-a? m ) - (remove-method-in-classes! m))) + (let ((gf (slot-ref m 'generic-function))) + ;; remove the method from its GF + (slot-set! gf 'methods + (delq1! m (slot-ref gf 'methods))) + (%invalidate-method-cache! gf) + ;; remove the method from its specializers + (remove-method-in-classes! m)))) (class-direct-methods c))) ;;; @@ -975,10 +981,7 @@ (make #:specializers (list class) #:procedure (cond ((pair? g-n-s) - (if init-thunk - (car g-n-s) - (make-generic-bound-check-getter (car g-n-s)) - )) + (make-generic-bound-check-getter (car g-n-s))) (init-thunk (standard-get g-n-s)) (else