develooper Front page | perl.perl6.language | Postings from April 2003

Re: S6 multimethod invocants

Thread Previous | Thread Next
From:
Paul
Date:
April 11, 2003 09:15
Subject:
Re: S6 multimethod invocants
Message ID:
20030411155357.7508.qmail@web41215.mail.yahoo.com

--- Luke Palmer <fibonaci@babylonia.flatirons.org> wrote:
> > Ok, this is strange to me.
> >   multi handle_event ($window, $event: $mode) {...} # two invocants
> > Does that mean I can assume $event is a valid object of some sort?
> 
> Yep. 
>     multi handle_event ($window, Undef $event: $mode) {...}
> Then you would get a valid undef object. :)

okay....and why would I want that?

> >   .stuff() 
> > is still going to default to $window, right?
> 
> Yes.  $_ binds to the first invocant.

Okay, that makes expected sense....

> > Or is that saying that if there is no $window.stuff() it'll look
> > for $event.stuff() ?
> 
> No.  If there's no $window.stuff, you'll get an error.

Okay, but I thought the main point of multimethods was that it could be
redefined and would be dynamically dispatched to the correct version
based on the invocant and/or arguments, i.e., the signature.

What, exactly, is the value of calling multiple arguments to one method
call "invocants"? I'm *really* missing something, here.....

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://tax.yahoo.com

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About