"Staggering power of closures..."
From: Dave Roberts (ldave-re-move_at_re-move.droberts.com)
Date: 03/28/04
- Next message: Kenny Tilton: "Re: Common Lisp on VMS?"
- Previous message: Peter Seibel: "Re: Method specialization style question"
- Next in thread: Kenny Tilton: "Matthew Danish must never say "stagger" again [was Re: "Staggering power of closures..."]"
- Reply: Kenny Tilton: "Matthew Danish must never say "stagger" again [was Re: "Staggering power of closures..."]"
- Reply: André Thieme: "Re: "Staggering power of closures...""
- Reply: Simon Adameit: "Re: "Staggering power of closures...""
- Reply: Anton van Straaten: "Re: "Staggering power of closures...""
- Reply: Tim Bradshaw: "Re: "Staggering power of closures...""
- Reply: Tayssir John Gabbour: "Re: "Staggering power of closures...""
- Reply: Kaz Kylheku: "Re: "Staggering power of closures...""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 28 Mar 2004 19:14:07 GMT
I managed to miss the great C vs. Lisp speed challenge earlier this month
when I was traveling (titled "Re: off-topic: open challenge to Christian
Lynbeck"). In the course of going back and reading that thread (good job,
guys, BTW! I learned a whole lot about Lisp optimization that I never would
have learned otherwise), I found a posting by Matthew Danish where he says:
> Perhaps one of the more difficult parts of learning Lisp from a C
> background is the realization of the power of the constructs, and
> acquiring the knowledge to know where and how to use them. A good
> example of this is closures. When I explain the concept to a typical C
> programmer, they often say something like ``oh, you mean static
> variables in functions'' or ``so what?'' Unless the person is versed in
> computability theory (and/or the lambda calculus) it is difficult for
> them to comprehend at first the staggering power of such a simple idea.
> The concept of a closure is a feature which is almost universal to
> high-level languages, and when you understand it is hard to imagine
> getting by without it.
This struck me. I was a C programmer, learned a whole lot of Java, and am
now trying to learn a whole lot of CL. As I have approached the language,
everybody keeps talking about closures as being one of the mind-blowing
pieces of it. Perhaps that's true when you're coming strictly from C, but I
find that I'm not as blown away with them after playing in the OOP world
for a while (C++, Java, etc. Yes, I know those object models have
issues--that's why I'm learning CL now). Whenever I see a closure, I simply
see an object. It's one or more functions connected to a local environment
that holds some private bindings.
In reading Paul Graham's papers on Lisp, I was struck that he was actually a
bit negative on OOP (CLOS, specifically), because he thought that most
everything you needed could be done with functions and closures.
So the question is, am I missing something staggering about closures, or
have I just grasped the idea so well before that I'm missing it now? Is
there something with closures that can't be done with objects in a Java
world, for instance? If so, what?
Note that I would actually rank first-class functions and powerful macros as
more staggering than closures as I have been learning CL. My point isn't
that CL doesn't have staggering features or even that closures aren't one
of them if you're coming from a world without objects. My question is
really, what am I missing about closures, if anything?
-- Dave Roberts ldave-re-move@re-move.droberts.com
- Next message: Kenny Tilton: "Re: Common Lisp on VMS?"
- Previous message: Peter Seibel: "Re: Method specialization style question"
- Next in thread: Kenny Tilton: "Matthew Danish must never say "stagger" again [was Re: "Staggering power of closures..."]"
- Reply: Kenny Tilton: "Matthew Danish must never say "stagger" again [was Re: "Staggering power of closures..."]"
- Reply: André Thieme: "Re: "Staggering power of closures...""
- Reply: Simon Adameit: "Re: "Staggering power of closures...""
- Reply: Anton van Straaten: "Re: "Staggering power of closures...""
- Reply: Tim Bradshaw: "Re: "Staggering power of closures...""
- Reply: Tayssir John Gabbour: "Re: "Staggering power of closures...""
- Reply: Kaz Kylheku: "Re: "Staggering power of closures...""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|