Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pacbell.com!pacbell!osc!jgk From: jgk@osc.COM (Joe Keane) Newsgroups: comp.object Subject: Re: Closures in C++ Summary: Closure takes operation as first argument. Keywords: lambda Message-ID: <4687@osc.COM> Date: 25 Mar 91 07:00:40 GMT References: <4578@m5.COM> <1991Mar2.052423.3231@objy.com> <4684@m5.COM> <1991Mar24.020701.27641@kestrel.edu> Reply-To: jgk@osc.COM (Joe Keane) Distribution: comp Organization: Versant Object Technology, Menlo Park, CA Lines: 19 In article <1991Mar24.020701.27641@kestrel.edu> gyro@kestrel.edu (Scott Layson) writes: >Therefore an instance, to me, is not exactly the same thing as a >closure, but they are very closely related: a closure can do only one >thing, while an instance can do any of several things depending on >which operation is invoked on it. But when someone says `an object is a closure', it's understood that the operation to be performed on the object is the first argument to the closure. So there's really no difference at all if you take this view. For example, you can define cons cells in terms of lambda calculus. You can define cons as `lambda(x,y).lambda(f).f(x,y)', car as `lambda(x,y).x', and cdr as `lamdba(x,y).y'. Actually, this works out to be very close to standard definition if you consider that a closure is a bunch of arguments allocated on the heap. It looks much different at first, but really it's just a different way of interpreting the same thing. -- Joe Keane, object hacker