Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re^5: How to conditionally execute a subroutine defined as hash value

by BrowserUk (Pope)
on Apr 02, 2014 at 11:44 UTC ( #1080758=note: print w/replies, xml ) Need Help??


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.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re^5: How to conditionally execute a subroutine defined as hash value

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1080758]
help
Chatterbox?
[Corion]: I still have to see the Pet Shop Boys live before they stop touring at all
[marto]: yeah, I think that as a group creatively they're done. I can understand how it'd be hard to stop the process, album/tour, album/tour, if that's pretty much all you've ever done :)
[marto]: Corion yes I saw them Pandemonium_Tour
[Corion]: marto: Yeah, and I doubt that they'll ever get back to something like Violator/Songs of Faith and Devotion - it would either alienate their "regular" crowd, or be "too much Violator" ;)
LanX needs to see Freddy Mercury'
[Corion]: marto: Yeah, I have that on DVD even, and I missed them last year because I was in London at the time ironically ;)
[marto]: put me in the mood to listen to this now :)
[Corion]: LanX: Well, grab a shovel :)
[Corion]: Kraftwerk also are still touring (well, only Ralf Hütter and Florian Schneider), but I'm too tight fisted to spend EUR 150+ for standing around two hours ;)
[Corion]: Oh. Queen have a new front man. Not really sure...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-03-24 11:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (301 votes). Check out past polls.