How much do you use CLOS?

I was just reading the poll topic in the Books forum about which Lisp book is your favorite. At one point in the discussion, I mentioned that a big difference between ANSI Common Lisp and Practical Common Lisp is the use and coverage of CLOS. Paul Graham doesn't seem to like CLOS and spent only a chapter covering it in ANSI Common Lisp, whereas Peter Seibel uses it all the time in Practical Common Lisp. I thought I'd ask people how much they use CLOS when writing day-to-day programs. In the discussion, feel free to provide some "color commentary" on your answer.

Personally, I tend not to use CLOS very often. It's not that I have some sort of a l33t spirit -- I just don't fancy object orientation for some projects. In fact, unless I absolutely require the use of OOP to make a meaningful architecture (e.g. I really need inheritance), I tend not to use it at all. Structures, or for some simple cases even simple lists are often more than enough.

I will admit, however, that I do enjoy CLOS when I use it. It's a very complete and powerful feature, and I especialy liked it when I saw it, considering that I was coming from the world of C++.

CLOS is amazingly powerful and above all it's amazingly simple to use when you look at how powerful it is. The other system i have played with, that seemed as friendly in it's approach to Object Orientation was Smalltalk but it didn't feel as natural to me since it enforces a strict OOP style and i tend to find that limiting and harder than it should. CLOS is great because you can use a powerful OO model without having to abandon other programming styles, you can simply mix the best of two worlds when they make sense.

I was originally going to vote for "When it makes sense" (or even a step down), until I realized that I frequently have a print-object method defined for my structs or conditions or whatever, and use conditions, and use defmethod on structs, etc. CL-SQL uses it, and I use that as well.

luskwater wrote:I was originally going to vote for "When it makes sense" (or even a step down), until I realized that I frequently have a print-object method defined for my structs or conditions or whatever, and use conditions, and use defmethod on structs, etc. CL-SQL uses it, and I use that as well.

To my own surprise, because I come from Java, I'm not using clos, only lists, maps, etc, and mostly functions or methods that are functional (no setf). I may be better off moving towards the middle with structs for certain things. But I would like to stay mostly functional.

mike wrote:To my own surprise, because I come from Java, I'm not using clos, only lists, maps, etc, and mostly functions or methods that are functional (no setf). I may be better off moving towards the middle with structs for certain things. But I would like to stay mostly functional.

What speaks against using structs or objects and still do functional programming? A simple example might be the implementation of a binary tree using structs. In spite of using structs there's no reason to use setf or other functions with side-effects...

mike wrote:To my own surprise, because I come from Java, I'm not using clos, only lists, maps, etc, and mostly functions or methods that are functional (no setf). I may be better off moving towards the middle with structs for certain things. But I would like to stay mostly functional.

What speaks against using structs or objects and still do functional programming? A simple example might be the implementation of a binary tree using structs. In spite of using structs there's no reason to use setf or other functions with side-effects...

I agree. I only meant to contrast it more with java where side-effects are commonplace.