Hello --

On Sat, 11 Aug 2001, MikkelFJ wrote:

> On the other hand, I wasn't really surprised that your example behaved as it
> did - whether it is illogical or not. And Ruby has a lot of dynamic power
> that can be questioned from a maintainance point of view: You can't possible
> know what an object is, because some obscure corner of the code could have
> changed it.

That's true, but that power is parceled out in sync with certain
built-in thresholds.  For instance, even though we know it's possible
to do this:

  class A
    def talk ; puts "hi" ; end
  end

  class B < A
    A.class_eval <<-EOE
      alias :oldtalk :talk
      def talk ; puts "hello" ; end
    EOE
  end

  class C < A
  end

  C.new.talk     # => hello


we would still, I think, not be happy if we started seeing this:

  class A
    def talk ; puts "hi" ; end
  end

  class B < A
    def talk ; puts "hello" ; end
  end

  class C < A
  end

  C.new.talk     # => hello


The fact that class variables behave this way may not matter as much
as it would if other things (like instance methods) behaved this way,
but my reaction to it is at the level of feeling that it interferes
with the infrastructure on which Ruby's freedom is built.

> Therefore, your argument might not imly that the design is wrong.
>
> But maybe classes aren't really objects after all. They are metaobjects, and
> inheritance has a different meaning, where the entire family is an object.
> It does give me a headache to think about this conceptually, although the
> actual use is intuitive.

But classes definitely are objects.  The entire family might in some
sense be a metaobject, though I'm not sure what lies down that
path :-)


David

-- 
David Alan Black
home: dblack / candle.superlink.net
work: blackdav / shu.edu
Web:  http://pirate.shu.edu/~blackdav