On Fri, May 07, 2004 at 01:39:43PM -0400, Austin Hastings wrote:
: I agree: classes have a chance to pre-specify the class
: signatures, and objects get a chance to dynamically agree to
: undertake method calls.
: 
: The timeframe I was thinking of was object construction time.

I don't see the value of that.  The class isn't going to be interested
in storing separate metadata for each object.  If the object stores
it itself then you might as well resolve it at dispatch time.

: What I'm looking for is a concrete class signature.
: 
: That is, I want an external entity to be able to inspect the
: class, or an object of the class, and KNOW what methods are
: supported.

That is what AUTOMETH supplies in the general case.  I'm sorry A12 was
not clearer about that.

: If the coder wants to implement everything via AUTOMETH and not
: tell me, that's okay.

I think you're confusing AUTOMETH with AUTOMETHDEF.  AUTOMETH has nothing
to do with implementation.  The closest it gets to implementation is to
return references to method objects that might or might not be defined yet.

: But if I was told what methods a class supports, I want to be able
: to manufacture a proxy for that class that supports the same
: methods, maybe a few more mixed in, and will report that concrete
: signature when inspected:
: 
: 4x:
: 
:   class Dog {
:     method bark {...}
:     method grow {...}
:     method scratch {...}
:     method sniff {...}
:     method walk {...}
:     method hunt {...}
:   }
: 
:   class prOxyGen
:   {
:     role proxy {...}
: 
:     method new($what)
:     {
:       $class = get_class($what);
:       $proxy = new MetaClass($class.name);
: 
:       $proxy.does(proxy);
: 
:       for $class.meta.methods() -> $method {
:         $proxy.add_method($method)
:               unless $method ~~ 'hunt';
:       }
: 
:       return $proxy;
:     }
:   }
: 
: If I say:
: 
:   my Dog $spot = new Dog('Spot');
: 
:   my $gettysburg_address = new prOxyGen($spot);
: 
: I want to be able to query $spot and get a list of public methods.
: 
: I want to be able to query $rover and get a similar list.
: 
: I *do not* want the signature for the proxy class to look like
: "stuff added by the proxy role, plus AUTOMETH".

The whole point of separating AUTOMETH from AUTOMETHDEF is so that
we can fake declarations.  I don't see the problem.  AUTOMETH is
automatically called whenever you ask for the metadata, whether that's
from a dispatcher or not.  How specific an answer you get from AUTOMETH
depends on how specific an answer you ask for.  That's the intent,
even if the details are a bit vague...

Larry

Reply via email to