in reply to Near-free function currying in Perl
I think that this task might be better handled as a special case of Aspects. (Aspect-Oriented Programming: Couple of Short Examples) It is a classic example of cross-cutting concerns. Especially nice about this is that you can curry function calls without making any code changes.
use Data::Dumper; use Aspect; before { my $context = shift; if (@{$context->params} < 1) { $context->append_param($context); } } call 'Data::Dumper'; print Dumper();
Of course, Aspect is a lot more overhead, so you need to choose the implementation that works better for you (but if you have a million function calls to curry ...)
|
---|