Question

im reading Practical common Lisp as a result of another question.

I just read chapter 16 and 17 where you can find how LISP manages objects. But after a couple of years of thinking how Java manages objects, i cant really seem to understand how you would implement bigger architectures in LISP using the CLOS.

So i ask you guys for some 20-50 pages reading about CLOS applied to bigger architectures than simple examples. Maybe a couple of blogpost or even experiences!

TY

Was it helpful?

Solution

Perhaps take a look at the example applications that are walked through in the later chapters. You will see that classes and objects are just another tool in your box. Resist the urge to program Java with Lisp syntax.

Another place to look at is Successful Lisp, chapters 7 and 14 for the basics, and chapters 31 and a part of 3.10 are about packages and handling large projects.

Some Lisp guru (it might have been Paul Graham, but I am not sure) once said that he has not needed CLOS at all yet.

edit: I think that your confusion may come from the fact that in Lisp, you do not use the class system for organizing namespaces. This is done separately; the two do not really have anything to do with each other.

OTHER TIPS

If you would like to get hold of the book, "Object-Oriented Programming in COMMON LISP" by Sonja E. Keene, Chapter 11 (Developing an Advanced CLOS Program: Streams) contains a non-trivial example with multiple inheritance spanning about 40 pages.

Eight classes are discussed in detail (stream, input-stream, output-stream, bidirectional-stream, character-stream, byte-stream, disk-stream and tape-stream). Concrete classes that a user would be expected to create instances of are then derived using multiple inheritance.

It's more substantial than the bank account example in Practical Common Lisp. You might also find the rest of Keene's book useful in gaining a deeper understanding of CLOS: the whole book is about CLOS.

If you really want to understand CLOS, you can go back and read The Art of the Meta Object Protocol, which provides the basis and the underlying code for Closette, a subset version of CLOS.

We at Weblocks also use the CLOS heavily, so you might want to browse the source a bit.

Bigger CLOS applications are 1) CAPI from Lispworks 2) cl-http webserver 3) a very large CLOS package is CLIM 4) if you like OpenGenera (that's a Lisp OS using Common Lisp and some predecessor ZetaLisp 5) a smaller package is http://www.cliki.net/mel-base

Regards Friedrich

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top