![]() |
|
Think about Loose Coupling | |
PerlMonks |
Re^6: Specializing Functions with Curryingby tilly (Archbishop) |
on Aug 06, 2004 at 21:04 UTC ( [id://380721]=note: print w/replies, xml ) | Need Help?? |
You're right that coming up with language to describe what you want often doesn't pay back when you are limited to a single tool that works how it works. But it pays back in spades when you are considering what you can do with different sets of tools. And it is indispensable when you're trying to design a tool. In Perl 5 it practically isn't worth the bother to think, "Oh, I could do this with currying" - you just do it with a closure and avoid the extra step. But if you know how to think about what you're doing as currying, then when you use a language with good support for currying, you will have some notions on when to reach for that rather than writing it in Perl 5. Alternately if you are working in a language that without support for closures, but you understand that all you really want is currying, then you can figure out ways to simulate the simpler concept rather than trying to do full-blown closures. Furthermore when it comes to designing tools, well have you read Perl 6 : Not Just For Damians? Take a look at the example of currying offered there. If Larry and Damian et al did not have language to discuss the idea of currying, would they ever have thought up such a nice way to do it? So yes, learning about currying is completely useless to you in day to day Perl 5 programming. But concluding that it is therefore a useless concept is a fast way to fall into the "Blub Paradox". See Beating The Averages if you don't know what that is.
In Section
Meditations
|
|