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

Reply via email to