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

Capture Object: why no verb?

Thread Next
From:
Dave Whipp
Date:
April 17, 2006 14:29
Subject:
Capture Object: why no verb?
Message ID:
20060417212842.13125.qmail@lists.develooper.com
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.

Compare:

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

   $shape.$message;
   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


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About