develooper Front page | perl.perl6.language | Postings from April 2006

Capture Object: why no verb?

Thread Next
Dave Whipp
April 17, 2006 14:29
Capture Object: why no verb?
Message ID:
Reading about capture objects, I see that they represent an arglist, and 
the the object to which you going to send those args. What is doesn't 
capture is the method name (the verb) that's being called. This feels 
like a slightly strange ommission.


   $message = &Shape::draw.prebind( x=>0, y=>0 );
   $capture = \( $shape: x=>0, y=>0 );

   draw *$capture;

These are both doing very similar things. The difference is only in the 
thing that's being associated with the arglist. In the case of currying 
it's the method whereas for the capture it's the invocant.

Perhaps I'm not fully groking the abstraction of the capture-object, but 
it seems to me that there should be a slot in it for the method. For 
dispatch, all three things are needed (invocant, method, args); so if 
you're going to put two of them in one object, then maybe the third 
thing belongs, too.

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About