Larry,

On Oct 14, 2005, at 2:15 PM, Larry Wall wrote:
Look guys, I want it to just consistently be

    method bark (Dog $d) {...}

regardless of how instantiated the dog is.  Think of partially
instantiated subroutines via .assuming.  A sub is a sub regardless of
how much it's been curried.  So who cares if it's a complete Dog or
a partial Dog, or a completely generic Dog?  Nobody cares until you
try to call a specific method that relies on some specific attribute.
If you call a sub with an incomplete definition, you should be prepared to handle the exception. If you call a method with an incomplete object,
you should be prepared to handle the exception.

Of course, by that argument, $d should be considered defined even if
it's a completely uninstantiated class object.  With subs the final
proof of actual well-definedness (not to be confused with .defined())
is whether it can be bound to a particular set of arguments.  It's a
rather lazy definition of well-definedness.  I'm proposing that
all objects follow the same model of not caring how well they're
defined until you actually try to use them for something.  I don't
think I care any more about whether classes test as defined or not.
It's like reality--there are a lot of complex problems where the
simplest way to simulate them is via reality itself, and all other
simulations are guaranteed to be slower.

I think what bothers me most about this is that it seems there is no way to tell the difference between class methods and instance methods. That the distinction is only made when the body of the method does something which is is not supposed to do (method called with a class invocant attempts to access an instance variable, etc).

This is one of the major problems that I have always had with Perl 5 OO. That there is a very fuzzy fuzzy line between the responsibilities of a class and an instance.

I can see the notion of "a class which is not yet instantiated", this makes sense in many contexts. But I don't think that in order to have this, we need to bring back this element of Perl 5 OO. I think we can still have all the behaviors you have been describing, and still keep classes and their instances as distinct entities.

But we have to think a bit more about the notion of currying class
objects into real objects, or something approaching real objects.

This is an interesting thought, I will have to ponder it some, but it has a nice smell. Of course I love indian food and functional programming, so that may be personal bias :)

Stevan

Reply via email to