> Date: Tue, 21 Jan 2003 10:04:58 +0000
> From: Graham Barr <[EMAIL PROTECTED]>
> 
> If the function form of map/grep were to be removed, which has been
> suggested, and the <~ form maps to methods. How would you go about
> defining a utility module similar to List::Util that uses the same
> syntax as map/grep but without making the subs methods on the global
> ARRAY package ?

I don't know whether you can use multimethods to do it, but if you
can, it would probably go something like this:

    sub wonk (@list: &code) is multi {
        grep {!code()} <~ @list
    }

So C<wonk> would be called like a method, but still not have access to
C<Array>'s private attributes as it's not a part of the class.

I don't know whether I like this or not.

Luke

Reply via email to