Although it seems somewhat antiquated these days, I'm interested in your opinions before uploading the module
Sub::Suspension - Suspended subroutine. An instance of this class behaves like a sub (-ref), but it supports partial application and the evaluation of operators applied to suspensions is suspended too. That means, evaluation has to be forced explicitly (which makes it easier to add introspection capabilities). Regarding partial application, this module is similar to Perl6::Currying and Sub::Curry. <http://search.cpan.org/~dconway/Perl6-Currying-0.05/> <http://search.cpan.org/~davidh/Sub-Curry-0.08/> Application of an operator to a suspension returns another suspension. The Symbolic calculator example from overload.pm uses similar mechanisms: <http://search.cpan.org/~nwclark/perl-5.8.4/lib/overload.pm#Symbolic_calculator> Example: use Sub::Suspension 'def'; $S = def sub : P1 P2 P3 { [EMAIL PROTECTED]; join '', @_{qw(P1 P2 P3)} }; print $S->( P1 => 1, P2 => 2, P3 => 3 )->(); # 123 $A = $S->( P3 => 1 ); # partial application $B = $S->( P3 => 2 ); $C = $A + $B; $D = $C->( P2 => 3 ); $E = $D->( P1 => 4 ); print $E->(); # force evaluation: 863 $F = $E - $D; $G = $F->( P1 => 0 ) / 2; print $G->(); # 400 print $G; # ( ( CODE(0x15e3818)( P1 => 4, P2 => 3, P3 => 1 ) + CODE ... $F->(); # Error: Free parameter : P1 $A->( P3 => 7 ); # Error: Bound parameter: P3 $A->( P4 => 7 ); # Error: Wrong parameter: P4 Related concepts are: thunk lazy evaluation defered evaluation delayed evaluation currying closure functor (qua function object) but I think the name 'suspension' matches best. Steffen
