Larry Wall wrote: <snip> > So what's the difference between a function and a method then? > Nothing on the implementation end. The only difference is in the > call end; we have different calling notations that invoke different > dispatchers. Each of those dispatchers resolves the membership > and ordering of its multiple candidates in its own way, using some > combination of namespace and type filtering, but not the presence or > absence of a ':' in either the Capture or the Signature. <snip> This all sounds reasonable to me, but I'm wondering how to make it work in certain ways that I would like. Case in point, with my Set::Relation module. That module is an object-oriented derivation of a module design that was originally just functional, having a collection data type as its main operand and all of its routines originally just being functions. The object-oriented Set::Relation is somewhat unnatural because its functionality is not supposed to consider any particular routine argument as special, that is an invocant. The reason I made it OO was so users wouldn't have to use Package.func syntax and wouldn't have to import the routines. Now, perhaps one solution is to make this non-OO and export its routines, but I figure people may want to say $arg1.foo($arg2) or whatever. Here's a question: Say I had an N-adic routine where in OO terms the invocant is one of the N terms, and which of those is the invocant doesn't matter, and what we really want to have is the invocant automatically being a member of the input list. For example, say we had "method natural_join of R (R $topic: Array of R $others)" but what we really want is "method natural_join of R (Array of R $topic)" so that within the natural_join method we can simply refer to the array $topic and the invocant just happens to be one of its elements, as if natural_join were just a function with no invocant. 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'm thinking maybe there was an answer to this in Synopsis 6 but I didn't see it. Thank you. -- Darren DuncanThread Previous | Thread Next