Nicolas Neuss <[EMAIL PROTECTED]> writes:
> Probably the following is a bug in goops-0.1.6:
Yes, it was.
> (use-modules (oop goops))
>
> ;;; an abstract vector class (numbers are a special case)
> (define-class <Vector> ())
>
> ;;; vector addition
> (define-generic vector+)
> (define-method vector+ () 0) ;; Warning: may not be the right thing ...
> (define-method vector+ ((x <Vector>)) x)
> (define-method vector+ ((x <number>)) x)
> (define-method vector+ ((x <number>) (y <number>)) (+ x y))
> (define-method vector+ ((x <Vector>) (y <Vector>))
> (error "has to be implemented for each nontrivial vector type"))
>
> ;;; method for arbitrary arguments (should only be used when nothing
> ;;; else fits)
> (define-method vector+ ( . args )
> (vector+ (car args)
> (apply vector+ (cdr the))))
>
> ;;; The following command hangs. I remember that I have obtained also
> ;;; the wrong result 3 in some situations.
> (vector+ 1 2 3)
>
>
> I tried to find a fix, but did not succeed... Sorry.
It was a difficult bug which you were not expected to find.
Thank you for reporting it!
2000-06-04 Mikael Djurfeldt <[EMAIL PROTECTED]>
* goops.scm (internal-add-method!): Bugfix: n-specialized must be
larger than the longest specializer list if any specializer list
contains a rest argument. The fact that a method with rest
arguments has been added is now coded in the sign of
n-specialized. (Thanks to Nicolas Neuss.)