From: Matthew Smillie Date: 2006-06-17T22:53:02+09:00 Subject: Re: self-similarity or closure in ruby On Jun 17, 2006, at 13:17, Robert Dober wrote: > On 6/17/06, uncutstone wu wrote: >> >> It seems >> In lisp, everything is expression >> In smalltalk, everything is object >> In Ruby, >> everything is an expression >> everything is an object >> >> This kind of characteristic is called closure. > > > I am afraid that is not correct (c.f. > http://en.wikipedia.org/wiki/Closure_%28computer_science%29 if you are > interested) > Cheers > Robert > > It is also a kind of self-similarity. Beware the Wikipedia, my son! The editors' bite, the facts which clash! Beware the disambiguation page, and shun the frumious Bandersnatch! (If I were more creative, I'd finish off the whole poem, but you get the point) There's a more relevant meaning of 'closure' given here: http://en.wikipedia.org/wiki/Closure_%28mathematics%29 This is more the sense which I think the original post was meant, and seems intuitively correct in that sense: in Ruby, any operation on an object results in an object. This is not true in the general case for OO languages (consider int vs. Integer in Java, or pointers in C++). I'm not as sure that Ruby is closed with respect to expressions in an interesting way. The not-so-interesting case that I can imagine is that any valid expression in a language results in a (possibly trivial or empty) valid expression in that language, which seems to me like a necessary condition to have a useful programming language in the first place. Maybe this definition of expression is too broad? matthew smillie.