[EMAIL PROTECTED] wrote:
: class Dog {
: method tail { "brown and short" }
: };
:
: class Chihuahua is Dog {
: has $.color;
: method tail { $.color _ " and short" }
: };
:
: You can say Dog.tail, Dog.new.tail, Chihuahua.new.tail, but not
: Chihuahua.tail. That's extremely counter-intuitive.
I don't think it's counterintuitive. You've defined Dog with an
invariant .tail but not Chihuahua. It's doing exactly what you asked
for under a prototype view of reality.
Except there are no such things as classes in a prototype view of
reality. Everything is an instance and there are no such things as
class methods. The entire idea that an object (::Dog) can call methods
that are for another object ($fido) is ... well ... it's a little off.
That's like saying any object can call any method from any other
object so long as that method is invariant.
In a prototype-instance system,
instance(Dog) isa class(Dog)
instance(Chihuahua) isa class(Chihuahua) isa class(Dog)
instance(Chihuahua) isa instance(Dog)
Note that instances inherit doubly, from own class and from parent's
instance.
But this does not imply that:
class(Chihuahua) isa instance(Dog)
So I don't see a problem.
Miro