views:

267

answers:

6

Hi, 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

+1  A: 

Can you give an example of an architecture? CLOS is pretty much a superset of the Java object system, so I'm not sure which architectures you have in mind...

Jules
+3  A: 

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.

Svante
In the case of pg, it's because he'd rather write his own broken version instead. Nearly everything in the Lisp world is an object -- CLOS is a good tool to know.
jrockway
jrockway, have you read Paul's source code?
Svante
In fact, the hyperspec defines "object" as "any Lisp datum": http://www.lispworks.com/documentation/lw50/CLHS/Body/26_glo_o.htm
Ken
+3  A: 

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.

Nelson
Keene's book provides exactly what this OP is seeking.
Technical Bard
+3  A: 

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.

Technical Bard
A: 

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

Friedrich
+2  A: 

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

skypher