Rod Adams writes:
> >Uhmm... isn't *&foo the adverbial block?  That is, isn't it where grep
> >gets its code block in:
> >
> >   @list.grep:{ $_ % 2 }
> >
> > 
> >
> 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 {
        ...
    }

The fact that there is a conflict in context in the argument points out
one of the weaknesses of the current multi declaraition semantics.
Currently, it would just default to list context.

I think the *compiler* should be able to tell the difference between the
two forms without having to go to runtime method dispatch (perhaps it
still does dispatch, but if you're in the latter form, you don't even
try to dispatch to the former routine).  But that's a big brainstorm
that needs to happen, and I'm not prepared to do that right now.

Luke

Reply via email to