On Wed, 15 Jan 2003 01:00:59 -0500, Dan Sugalski wrote:
> At 8:53 PM -0800 1/14/03, Adriano wrote:
> >I think what Jonathan asked for was an operator for returning a method
> >(as an object) which can be invoked later with some arguments (or even
> >applied with a partial list of arguments for currying). This would be a
> >lot more useful than a yes-or-no answer about the existence of a method.
>
> I thought about this--it's what the find_method vtable method was for in
> the first place. Unfortunately, as was pointed out to me, there's no good
> way to cache the result, since it could potentially be wrong by the time
> the method is actually called.

Is that such a big deal? The same problem exists in perl 5 with the
following code:

  if(my $meth=$obj->can($action)){
    # Stuff could happen here which redefines the method in $obj's class
    # However, I know it won't get redefined because I wrote the whole system
    $obj->$meth();
  }else{
    die "Some custom error message or appropriate action";
  }

Surely it's up to the person/compiler writing the code to decide whether it
matters that the method has been redefined in the meantime. We shouldn't
prevent something useful just because it's not universally applicable.

-- 
        Peter Haworth   [EMAIL PROTECTED]
"I can talk on this stuff for hours when given insufficient discouragement."
                -- Dan Sugalski

Reply via email to