Log in

No account? Create an account

Lisp Usenet classics

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




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) ...).