Why not? For example, here I use currying to pre-bind a method to a particular object instance:
I stand corrected. Very nice example.
To clarify, I didn't say that there was anything wrong with design-time consideration of currying. What I said was that it was a bad idea to require design-time considerations in order to make a currying scheme work. With such a requirement, the vast existing wealth of CPAN is placed beyond the reach of currying.
I don't want my ability to use currying to be dependent upon somebody else having designed it into the code I'm using. I want to be able to take old, existing code and curry it, as is.
I agree that it can be nice to not have to require design time considerations for currying to work in many cases. Although I think saying that the all of CPAN is now your curried oyster is maybe a little presumptious. For instance, any function which makes use of caller may or may not work properly, and stack traces will quite possibly get very messy. There is a lot of crazy code on CPAN (and not just TheDamians) and I would guess that some of it would not respond well to currying.
I guess my point really is that currying is something which is not to be used lightly. It is, by its very nature, an advanced technique which is not easily accessible or understandable to most programmers who were trained in procedural or OO programming. A well crafted Haskell or Standard ML function will be built with the understanding, that it will almost certainly be curried at some point. Old perl code will almost certainly not be built with the same considerations. That is not to say that you shouldn't still use currying in those situtations, but I think it ill advised to imply that currying can breath new life into old code.
In reply to Re^7: Near-free function currying in Perl
by stvn
in thread Near-free function currying in Perl
by tmoertel
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |