in reply to Re^4: How to conditionally execute a subroutine defined as hash value
in thread How to conditionally execute a subroutine defined as hash value
Not sure i like the lock-in you get with the anon sub approach.
Personally, I see your method causing more lock-in than mine. You're committing them to a single parameter.
Of course, you can then make it an anonymous array, and pass that.
But now you are creating yet another level of indirection and nesting, and parallel data structures, all of which then needs to be mentally unwound to work out what gets passed to what.
The delegate -- anonymous sub that encapsulates code references along with their arguments (by closure) -- is a very well tried and tested mechanism used by FP languages almost exclusively. It's clear, concise and can usually be in-lined.
|
---|