CLOS usage

Discussion of Common Lisp

How much do you use CLOS?

All the time, I think in CLOS
1
3%
Fairly often
14
37%
Sometimes, when it makes sense
13
34%
Not very often
7
18%
Never! CLOS is for the weak
3
8%
 
Total votes: 38

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

CLOS usage

Post by findinglisp » Fri Jul 04, 2008 11:23 pm

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.
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

donkey
Posts: 11
Joined: Sun Jun 29, 2008 11:05 am

Re: CLOS usage

Post by donkey » Sat Jul 05, 2008 12:30 pm

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++.

AlexPaes
Posts: 21
Joined: Sat Jun 28, 2008 3:38 am
Location: Lisbon, Portugal

Re: CLOS usage

Post by AlexPaes » Sat Jul 05, 2008 1:02 pm

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.
CL-USER> (setf *boss* (make-instance 'smart-person))
NIL
CL-USER>

Jeff
Posts: 2
Joined: Fri Jul 04, 2008 8:39 am
Location: Ohio, US
Contact:

Re: CLOS usage

Post by Jeff » Sat Jul 05, 2008 5:09 pm

I tend to use methods with structs more than classes.
Jeff Ober
---
Old programmers don't die; they just parse on...

Alexander Lehmann
Posts: 23
Joined: Sat Jun 28, 2008 11:27 pm
Contact:

Re: CLOS usage

Post by Alexander Lehmann » Sun Jul 06, 2008 7:27 am

Hm, I like CLOS and fairly often use objects. However, I prefer using "regular" functions instead of methods wherever methods aren't explicitly neccessary.

luskwater
Posts: 3
Joined: Tue Jul 08, 2008 5:29 am
Location: Philadelphia, PA, USA
Contact:

Re: CLOS usage

Post by luskwater » Tue Jul 08, 2008 6:59 am

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.

findinglisp
Posts: 447
Joined: Sat Jun 28, 2008 7:49 am
Location: Austin, TX
Contact:

Re: CLOS usage

Post by findinglisp » Tue Jul 08, 2008 7:38 am

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.
"Resistance is futile..." :D
Cheers, Dave
Slowly but surely the world is finding Lisp. http://www.findinglisp.com/blog/

mike
Posts: 4
Joined: Wed Jul 09, 2008 1:25 pm
Location: San Francisco, CA
Contact:

Re: CLOS usage

Post by mike » Wed Jul 09, 2008 6:25 pm

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.

Alexander Lehmann
Posts: 23
Joined: Sat Jun 28, 2008 11:27 pm
Contact:

Re: CLOS usage

Post by Alexander Lehmann » Wed Jul 09, 2008 11:17 pm

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
Posts: 4
Joined: Wed Jul 09, 2008 1:25 pm
Location: San Francisco, CA
Contact:

Re: CLOS usage

Post by mike » Thu Jul 10, 2008 12:02 am

Alexander Lehmann wrote:
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.

Post Reply