develooper Front page | perl.perl6.language | Postings from March 2009

Re: new Capture behavior (Was: Re: r25685 - docs/Perl6/Spec)

Thread Previous | Thread Next
From:
Darren Duncan
Date:
March 5, 2009 15:59
Subject:
Re: new Capture behavior (Was: Re: r25685 - docs/Perl6/Spec)
Message ID:
49B06777.9000804@darrenduncan.net
Darren Duncan wrote:
> So, is there some way, or is it reasonable for there to be, to declare a 
> method in Perl 6 such that say it is declared with say an Array of R or 
> Set of R etc parameter and that parameter is marked somehow, maybe with 
> a trait, to say it automatically gains the invocant as one of its 
> elements?  This is sort of the opposite of unpacking array parameters.  
> Maybe something like "method natural_join of R (Array of R $topic is 
> enveloping self)", but keep in mind that it should work if the 
> parameters in question are named instead.  Then one could invoke it with 
> say "$r1.natural_join( [$r2, $r3] )" or some such.

I should further qualify my question/request, which should also bring it more on 
topic with the thread, is that ideally the same single routine declaration would 
DWIM regardless of whether it is invoked as $obj.meth syntax or whether the 
routine is exported and called with meth($obj) syntax.  Larry said essentially 
that the invocant is just another parameter for the most part.  And what I'm 
asking is a way that the invocant could be combined into a distinct 
Array|Set|etc parameter when an invocant exists, and the parameter is just 
itself otherwise. -- Darren Duncan

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