[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: around method for make-instance
- To: info-mcl@cambridge.apple.com
- Subject: Re: around method for make-instance
- From: tar@ISI.EDU
- Date: Thu, 18 Nov 1993 16:09:34 -0800
- In-reply-to: djskrien@COLBY.EDU's message of Thu, 18 Nov 93 17:09:33 -0500
- Posted-date: Thu, 18 Nov 1993 16:09:34 -0800
- References: <9311182209.AA17272@host4.COLBY.EDU>
- Reply-to: tar@ISI.EDU
In article <...> djskrien@COLBY.EDU (Dale J. Skrien) writes:
>
> Is there something special about putting methods
> around the make-instance primary method?
> ...
> But when I define:
>
> (defmethod make-instance :around
> ((x foo) &rest initargs)
> (let ((instance (call-next-method)))
> (list instance)))
>
> then I get:
>
> ? (make-instance 'foo)
> => #<FOO #x17E44F1>
>
> Shouldn't I have gotten:
> (#<FOO #x17E44F1>)
>
Because the argument to make-instance, 'foo, is of type SYMBOL, not of
class FOO! You would need to have the method specialized on (eql 'foo):
(defmethod make-instance :around
((x (eql 'foo)) &rest initargs)
(let ((instance (call-next-method)))
(list instance)))
________________________________________________________________________
Thomas A. Russ, USC/Information Sciences Institute tar@isi.edu
4676 Admiralty Way, Marina del Rey, CA 90292 (310) 822-1511x775