On 1/18/06, Larry Wall <[EMAIL PROTECTED]> wrote:
> On Wed, Jan 18, 2006 at 01:56:53PM -0500, Rob Kinyon wrote:
> : Today on #perl6, Audrey, Stevan and I were talking about $repr. A
> : tangent arose where Audrey said that the difference between class
> : methods and instance methods was simply whether or not the body
> : contained an attribute access.
> :
> : Is this true? If it is, then I think it violates polymorphism as
> : demonstrated by the following:
> :
> : 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.

> : I think that class methods should be explicitly defined as class
> : methods and you cannot call a class method upon an instance, just as
> : you cannot call an instance method upon a class. Plus, this should be
> : determinable (for the most part) at compile time, which is a bonus,
> : imho.
>
> I believe this is already determinble at compile time for the most part.
>
> But I have a strong gut-feeling that over the long term it's going to
> be important to be able to view a given object as either a partially
> instantiated class or a partially undefined object, and for that we have
> to break down the false class/instance dichotomy.  And to the extent
> that the dichotomy *isn't* false, we're trying to sweep classness into
> the .meta object, which is the *real* class object in Perl 6.

I'm sure you understand the distinction you're making. I know I don't
and I've been trying to follow this discussion for the past year. I'm
may not be the brightest bulb in the chandelier, but I'm no 15W dimmer
switch, either.

Frankly, you should be using people like me, Matt Fowles, and the
other  programmers on the list as sounding boards. If we're having
problems understanding the concept, then how are we going to explain
"partially-instantiated classes" on Perlmonks or #perl or clmp? Like
it or not, we're the sergeants in the Perl army. We're the guys
explaining all this stuff to the privates coming up the ranks. It may
be a nice extension to have, but I'm not sure this should be part of
the standard MOP.

Rob

Reply via email to