On 6/17/06, Matthew S. [email protected] wrote:
everything is an object
It is also a kind of self-similarity.
Beware the Wikipedia, my son!
Hey I just defended you in the other thread, daddy!
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
There’s a more relevant meaning of ‘closure’ given here:
I see what OP meant, thanks for the link, but
/Closure_%28computer_science%29 is not a bad description of what a closure
is in the context of ruby.
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++).
The mathematical way to say ruby is consistent in concept, I agree.
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?
Well I still guess OP ment the consistentcy, in that brings me to the
As everything is an object there are only methods, look e.g. at these
snippets in ruby first
and now in python
Now we can also easily extend or redefine methods on the built in
irb(main):006:0> class Fixnum
irb(main):007:1> def +(x);0;end
I choose this stupid example to show the danger which comes with the
I am sure others will come up with much more advantages.
Deux choses sont infinies : l’univers et la bÃªtise humaine ; en ce qui
concerne l’univers, je n’en ai pas acquis la certitude absolue.