|Subject:||Re: GOOPS: calling next-method with different arguments.|
|Date:||Sun, 21 Apr 2013 18:05:18 +0200|
Hey,I've been trying to make some deeper inquiry. It turns out that the case is not as simple as I thought.I came up with the following function(use-modules (oop goops) (ice-9 match) (srfi srfi-1))(define (parent-methods method class)(let* ((supers (class-direct-supers class))(super? (lambda(c)(find (lambda(s)(eq? c s)) supers))))(filter-map (match-lambda((method (? super? super) args ...) method) (else #f))(map (lambda(m)(cons m (method-specializers m)))(generic-function-methods method)))))it works more or less as expected, at least for initializers (because it is defined in such way that it only looks at the method's first argument) -- it does return a list of parents' initializers.The problem appears if a parent's initializer contains (next-method) invocation. Otherwise (if there's no call to (next-method)) the method contains a procedure in its 'procedure' slot, which can be accessed using `method-procedure`, and then called or applied in a regular manner.However, if there is a call to (next-method) in a macro, the `method-procedure` called on such method returns #f. I think the idea is that methods are meant to be called from the context of `apply-generic` and next-method is a continuation, but I haven't figured out how it works exactly.Anyway, the thing isn't as simple as I thought and perhaps someone else could try another approach.Sorry for causing confusion!M.
|[Prev in Thread]||Current Thread||[Next in Thread]|