Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Near-free function currying in Perl

by idsfa (Vicar)
on Nov 17, 2004 at 17:47 UTC ( #408497=note: print w/replies, xml ) Need Help??


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 ...)


The intelligent reader will judge for himself. Without examining the facts fully and fairly, there is no way of knowing whether vox populi is really vox dei, or merely vox asinorum. -- Cyrus H. Gordon

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://408497]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2020-12-03 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (52 votes). Check out past polls.

    Notices?