[e-lang] Wiki Software
smagi at higherlogics.com
Tue Nov 28 21:56:16 CST 2006
Tyler Close wrote:
> On 11/28/06, Sandro Magi <smagi at higherlogics.com> wrote:
>> Well, objects are a simply poor man's closures
>> (http://www.kimbly.com/blog/000063.html). ;-)
> I disagree with the parable on that page. Object does not imply
> lexical closure. C++ has objects, but does not have lexical closures.
> You can understand objects in terms of lexical closures, but not
You certainly can: a closure is simply an object where the lexically
captured variables are exposed in the object's constructor. This is how
many FP languages implement closures on the JVM and .NET VM.
> In the absence of lexical closures, you need to have
> public/private distinctions, constructors, and other busy work
> occupying the days of the object-only programmer.
Class definitions and object construction are definitely a bit more
verbose in most current OO languages.
More information about the e-lang