fix chaining up from interpreted to compiled methods; allow compiled init-thunk
authorAndy Wingo <wingo@pobox.com>
Fri, 31 Oct 2008 09:14:49 +0000 (10:14 +0100)
committerAndy Wingo <wingo@pobox.com>
Fri, 31 Oct 2008 09:14:49 +0000 (10:14 +0100)
* libguile/goops.c (scm_sys_initialize_object): Don't assume that an init
  thunk is a closure; just go through scm_call_0 instead.

* oop/goops/compile.scm (make-make-next-method/memoizer): Allow for the
  case that the next method is compiled.

libguile/goops.c
oop/goops/compile.scm

index f647cca..1b8cdc1 100644 (file)
@@ -583,13 +583,10 @@ SCM_DEFINE (scm_sys_initialize_object, "%initialize-object", 2, 0, 0,
            {
              slot_value = get_slot_value (class, obj, SCM_CAR (get_n_set));
              if (SCM_GOOPS_UNBOUNDP (slot_value))
-               {
-                 SCM env = SCM_EXTEND_ENV (SCM_EOL, SCM_EOL, SCM_ENV (tmp));
-                 set_slot_value (class,
-                                 obj,
-                                 SCM_CAR (get_n_set),
-                                 scm_eval_body (SCM_CLOSURE_BODY (tmp), env));
-               }
+                set_slot_value (class,
+                                obj,
+                                SCM_CAR (get_n_set),
+                                scm_call_0 (tmp));
            }
        }
     }
index 2e58365..ecd0232 100644 (file)
            (set-cdr! vcell (make-final-make-no-next-method gf))
            (no-next-method gf (if (null? args) default-args args)))
          (let* ((cmethod (compute-cmethod methods types))
-                (method (local-eval (cons 'lambda (cmethod-code cmethod))
-                                    (cmethod-environment cmethod))))
+                (method
+                  (if (pair? cmethod)
+                      (local-eval (cons 'lambda (cmethod-code cmethod))
+                                  (cmethod-environment cmethod))
+                      cmethod)))
            (set-cdr! vcell (make-final-make-next-method method))
            (@apply method (if (null? args) default-args args)))))))