Re: Allegro and Sbcl disagree on no-primary-method behavior



Jim Newton <jimka@xxxxxxxxxxx> writes:

Does anyone know what the behavior should be if a generic function has
an around method which does NOT call call-next-method, but there is
no primary method?
....
(defgeneric foo (x))
(defmethod foo :around (x) 1)
(foo 1)

This returns 1 in allegro, and errors in sbcl. Any opinions
about which is correct behavior?

From the other posts, it appears that signaling the error is correct
behavior.

It would be pretty easy to get something like the Allegro behavior, but
in an ANSI-compliant way by just adding a default primary method that
signals an error:

(defmethod foo (x) (error "Shouldn't get here."))

This would allow the around method to work as long as it didn't try to
actually get to the primary method.


--
Thomas A. Russ, USC/Information Sciences Institute
.



Relevant Pages