Luke Palmer wrote:

Rod Adams writes:


In S29, I currently have C<grep> as:

multi sub grep (Any|Junction $test : [EMAIL PROTECTED]) returns List {
gather {
for @values -> $x {
take $x if $x ~~ $test;
}
}
}



That's the listop form. I was referring to the method form:

multi sub grep (@array: *&code) returns List {
...
}


Got it. I'll be adding that form to various functions shortly.

Could I please get a list of what forms I need to be defining in S29?

Right now I have:
- General non-OO form.
- adverbial code block form (where applicable).


I haven't gotten a solid answer on when and how Perl will autogenerate methods from subs.


For instance, would

 @array.grep(/foo/);

generate a call to the list op C<grep> above, or do I need to be defining another form of C<grep> that's more agreeable to autogeneration? If so, what makes a sub more agreeable to auto method generation?

-- Rod Adams

Reply via email to