Trying to learn: Object Reorientation, and generic functions in LISP!
Asked Answered
G

5

6

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

Gaffney answered 12/1, 2009 at 22:45 Comment(1)
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...Nakasuji
R
4

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.

Rubber answered 13/1, 2009 at 0:30 Comment(2)
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.See
In fact, the hyperspec defines "object" as "any Lisp datum": lispworks.com/documentation/lw50/CLHS/Body/26_glo_o.htmNumerous
N
7

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.

Niel answered 13/1, 2009 at 0:38 Comment(2)
Keene's book provides exactly what this OP is seeking.Convulsion
Sonya is (was, she has retired) one of the best technical writers ever. Her book is very clear, and has been very closely vetted by the creators of CLOS.Miyokomizar
C
5

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.

Convulsion answered 13/1, 2009 at 3:38 Comment(1)
This book is fantastic, but is more about the underlying theory and beauty of CLOS than it is about practical workaday development. I think the latter is more what is being asked for here.Miyokomizar
R
4

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.

Rubber answered 13/1, 2009 at 0:30 Comment(2)
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.See
In fact, the hyperspec defines "object" as "any Lisp datum": lispworks.com/documentation/lw50/CLHS/Body/26_glo_o.htmNumerous
S
2

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

Shiny answered 3/3, 2009 at 10:24 Comment(0)
C
0

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

Crystallize answered 17/1, 2009 at 19:20 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.