in reply to Re: (jeffa) Re: (USING POE!) Re: 'better mousetrap': how to perform timed event
in thread 'better mousetrap': how to perform timed event

Heh heh ... thwack away! ;)

"... is it simply an issue of pre-emptive maintenance coding headache prevention?"

I think so. What if you suddenly decide that the string you need to match needs to be dynamic? You forget to remove the o modifer and possibly spend a lot of time trying to find the bug when your regex stops matching. Here is some code to demonstrate:
@data = qw(foo bar baz qux); { print "search: "; chomp ($in = <STDIN>); last unless $in; print $_,$/ for grep /\Q$in\E/o, @data; redo; }
I figure why bother with such premature optimizations if they have the potential to bite.


(the triplet paradiddle with high-hat)
  • Comment on (jeffa) 3Re: (USING POE!) Re: 'better mousetrap': how to perform timed event
  • Download Code

Replies are listed 'Best First'.
Re: (jeffa) 3Re: (USING POE!) Re: 'better mousetrap': how to perform timed event
by Anonymous Monk on Apr 24, 2003 at 08:25 UTC

    yet another perfectly usable, very useful facility of perl consigned to the bit-bucket of jaundiced opinion because one self-ascribed expert got bitten by it once.

      Sorry, you are totally wrong.

      1. You are posting as Anonymous Monk. If you feel you have to make that kind of opinionated statement, log in. Yes, you will be downvoted, but PerlMonks is not about XP, right?

      2. jeffa never denied the general usefulness of the /o modifier. He merely states it bothers him, and gave a good explanation why. He even called his own behaviour "cargo-cultish", which should be enough to tell you that he doesn't want to push /o in the bit bucket.

      3. jeffa probably doesn't need to be "jaundiced". He is a long-standing member of PerlMonks and an experienced programmer. Not everybody plays silly games all the time.

      4. He didn't call himself an expert.

      5. IMHO, it is clever to only get bitten once, and then think about it. Not that he mentioned that he only got bitten once, though.

        1. If XP doesn't matter, then what matter the originator of the opinion? If the opinion has merit, factor it into your thinking, if not, move and ignore it. Down vote if that makes you feel vindicated.

        2. Cargo-cult implies this is rote-learnt behaviour rather than experiential conclusion. Consider from where this behaviour might have been culted.

        3 thru 5. You assume too much when you assume the comment was directed at jeffa or any other individual. History is the key. Where did the culted behaviour originate? How and why does it perpetuate?

        When the language designers added the /o modifier, they obviously perceived of the circumstance when such optimisation would be useful and beneficial. Dismissal under a catch-all term as a micro-optimisation suggests that the designers were wrong. Its strange how often it is the same voices that routinely attribute the wares of MS, Sun and others as bloated and being part of a conspiracy to fuel the need for hardware and software upgrades, that are the first to condemn those that attempt to write clean, efficient, optimal perl code.

        Add this to the list of other perl features equally dismissed in this place as being non-useful: symbolic references, global variables, goto, c-style for loops, regexen of any complexity, while loops whith implicit assignment to $_ and all the other things that have variously been "condidered harmful".

        nah, this one doesn't need to login, it's easy enough to tell that it's that anonymous.

        If you feel you have to make that kind of opinionated statement, log in.

        One question comes to mind. Why? It's not as if it changes anything. It doesn't increase your accountability in any way. Maybe you'd like every anonymous monk to post their full legal name, address, phone number, and zip code? How about we get our respective governments to mandate authentication software, would that make you feel better?

        Let the post stand on its own. Analyze what is said, don't worry about who posted it. You'll learn a lot more.