in reply to Re^8: Near-free function currying in Perl
in thread Near-free function currying in Perl
Now, granted, once you grok references, currying is far less complicated than inside-out objects. It's nothing more than fancy caching, just like you said. And, if you know that your maintainers will all be in that 10% of Perl programmers, then it's no more complicated than the map-sort-map of the ST.
As for what Perl might break ... you just might be right. Anything that depends on caller(), B::*, or is sufficiently introspective will probably have issues. But, I've been testing out my Currying implementation based on attributes and it seems to be taking everything I've been throwing at it. A few of the crazier things have been:
# Named closures { my $x = 0; sub inc_x : curry($) { $x += shift } } # run-time binding sub foo : curry($); BEGIN { *foo = sub { print "@_\n" } }
It didn't handle the following, but I think that's because of me screwing up the attribute handler.
That created an infinite loop, but I'm not sure why.sub foo : curry($); my $ref = foo(); $ref->('hello');
Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^10: Near-free function currying in Perl
by tilly (Archbishop) on Nov 18, 2004 at 17:23 UTC | |
Re^10: Near-free function currying in Perl
by Jenda (Abbot) on Dec 12, 2004 at 23:48 UTC | |
by BrowserUk (Patriarch) on Dec 13, 2004 at 06:08 UTC | |
by tilly (Archbishop) on Dec 13, 2004 at 17:55 UTC | |
by dragonchild (Archbishop) on Dec 13, 2004 at 15:00 UTC |