"Josh Stern" <jstern / foshay.citilink.com> wrote:

> Proc's, mentioned earlier, are unamed function objects.  In Ruby,
> the instance object also acts much like a namespace on its own,
> as does the class (which is also an object).

This is interesting. I am enamored of the idea that classes are objects, and
also that an instance has it's own dynamic namespace. This parallels my own
work on language design, providing classes as first-class objects. I must
look into this further with Ruby.

I was intrigued when I learned that you can add methods to instances in
Ruby. My own experiences with this methodology didn't lead to anything very
useful (there must be an interface contract, else you are effectively
writing in assembly). However I am interested to see what uses others can
find.

> Ruby does have its
> version of what C++ calls static class member functions - they
> are called class methods, and the class methods of the base
> class Object are analogous to global functions in the global
> namespace.

Fairynuff. But what about scope? I want my cake and to eat it too: I want
global functions, but I don't want to pollute one single space with
disparative things. Modularisation remains important at a number of levels,
and it seems a shame to ignore it within such an important, err, scope. If
Ruby were really 'object oriented', the global scope is more than one single
static object: it is a subset of a larger hierarchy of scopes. Perhaps I
should shut up, go away and add hierarchical namespaces to Ruby.

> -= Josh

Christian.