"Christian Szegedy" <szegedy / t-online.de> wrote in message
news:an4t5r$fh$01$1 / news.t-online.com...
> FYI, I found this while googling:
>
> www.cs.washington.edu/homes/kd/courses/pythonruby.pdf
>

The above discusses the uniform access of everything is an object and
compares to Java: Math.abs versus -3.abs in Ruby.

This reveals something I've only slowly grown to realize in OOP: It's no so
much that objects have methods as it is the fact that the object does all
the scope resolution for you. You can have ten different functions of the
same name but the object always know which one is relevant.

When comparing at functional language like OCaml (ignoring it's object
system) to Ruby, it doesn't really matter whether you write "find obj 2" or
you write "obj.find 2". However, it does matter whether you write "Hash.find
obj 2" or you write "List.find obj 2". In other words, the functional style
requires you to know what kind of an object you are dealing with and use the
correct find function. But this is rendundant as the object already knows
it, regardless of static or dynamically typed (except OCaml sometimes
derives the type of the object based on the formal argument types of the
function).

Templates and generics deals with the above problem. Templates require the
object to be typed wheras Ruby stores the available functions in a class,
which is essentially just making the type lookup at a different space and
time.

Perhaps OO is more about scope than it is about objects and perhaps a new
language could be designed to work on scopes rather than objects. I already
see Ruby as more of a scope managing system than an OO language. If you look
at Lua there is a few things in common, but Lua does not manage scope,
whereas Ruby does in the concept of objects and classes.

Mikkel