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

September 2014

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
282930    
Powered by LiveJournal.com