Lisp Usenet classics

Here are some past Erik Naggum Usenet articles for your reading pleasure.

Tags:

Comments

(Anonymous)

Re: Object Orientation and what it means in Common Lisp

It might help to take a look at MAKE-INSTANCE. I think it has the protocol you want.

(defgeneric make-instance (class &rest initargs))

You can specialize on the first argument and have the interpretation of the rest of the argument list handled by the various methods. Using this pattern, you can write:

(talk (make-instance 'dog))
(talk (make-instance 'human) :word "lisp")

Aside: Note that MAKE-INSTANCE plays a little trick where (make-instance 'foo ...) simply calls (make-instance (find-class 'foo) ...).

Eric

April 2015

S M T W T F S
   1234
567891011
12131415161718
19202122232425
2627282930  
Powered by LiveJournal.com