[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: redefining methods
- To: eliot handelman <eliot@winnie.Princeton.EDU>
- Subject: Re: redefining methods
- From: Gregor.pa@Xerox.COM
- Date: Sun, 18 Sep 88 21:29 PDT
- Cc: burdorf@rand-unix.ARPA, CommonLoops.pa@Xerox.COM, dave@rand-unix.ARPA, shane@rand-unix.ARPA, steph%ixta@rand-unix.ARPA
- Fcc: BD:>Gregor>mail>outgoing-mail-4.text.newest
- In-reply-to: <8809190238.AA19917@Princeton.EDU>
- Line-fold: no
Date: Sun, 18 Sep 88 22:37:08 edt
From: eliot%winnie.Princeton.EDU@Princeton.EDU (eliot handelman)
You can get the error like this:
(defun foo (x) nil)
(defclass baz () ((s :accessor foo)))
This code is illegal according to the CLOS specification. On page 2-46,
in the description of ensure-generic-function says:
If (SYMBOL-FUNCTION <identifier>) is a non-generic function,
a macro or a special form, an error is signalled.
The reason for this, is that defmethod (and ensure-generic-function)
believe that they help to build generic function definitions
incrementally. When they see a normal function, they have no way to
know how to have its definition contribute to the definition of the
whole function.
What you *may* want to do is:
(defun foo (x) nil)
(eval-when (load eval)
(pcl::make-specializable 'foo :arglist '(x)))
(defclass baz ()
((s :accessor foo)))
-------