in reply to Re: Re: detecting $& usage
in thread detecting $& usage

My application is a verilog authoring tool that includes a perl based parser (using m/\G//). It also allow users to embed perl that I "eval". So, I am not the author of all code. If the user code uses "$&" then my tool slows down 20X.
Then why is it your problem? The user could put in a sleep 1_000_000_000 as well, or use a billion other ways to slow down the entire program. That's the risk you take when evalling code. You might as well disallow all Perl primitives.

Abigail

Replies are listed 'Best First'.
Re: Re: detecting $& usage
by sleepingsquirrel (Chaplain) on Jan 27, 2004 at 17:18 UTC
    Then why is it your problem? The user could put in a sleep 1_000_000_000 as well, or use a billion other ways to slow down the entire program.
    It's his problem, because he's more concerned with actually accomplishing a task, rather than conforming to some bureaucratic "rules" about what is and what isn't in his job description. And since he's building verilog tool, I'll bet his "users" are highly educated engineers who are trying to get actual products out the door and he's trying to prevent any unnecessary slow downs caused by inadequate knowledge of perl trivia on the part of his users. I'd guess he is not attempting to prevent his users from being malicious. In my mind, I picture this scenario: they've got an IC tapeout 1 week away, and one of the 20 engineers on the project has tweeked some his tests a little at the last minute (to better catch bugs, because these bugs cost $1+ million in NRE per spin for a 0.1um CMOS process), and it now uses $&. It runs fine on his tiny test circuit, but when it gets rolled into the full 100 million gate IC, the test that used to take 5 hours now takes 100 hours. Oh, and they probably lose $50,000 a day in revenue for every day they slip (ouch).
      If they are highly educated, why not just say "if you use $&, the program slows down heavily", and let the highly educated engineers decide whether it matters or not.
      In my mind, I picture this scenario: ...
      I think they company would benefit much more from getting a decent testing procedure than to focus on one particular issue that might cause a slow down.

      Your situation is best described as "penny-wise, pound foolish". Except that the pounds are worth lots of dollars.

      Abigail

        Have you ever tried to teach an engineer? They just want to use what will get their job done. Some are even vehemently against some techie telling them not to do something.

        Usually, they are pretty good, but there are some that just don't think they need to change.

        --MidLifeXis

        If they are highly educated, why not just say "if you use $&, the program slows down heavily", and let the highly educated engineers decide whether it matters or not.
        Exactly how is that different from what the original poster wanted?
        Anyone know how I can detect the use of $', $& or $' ? Using these variables kills the performance of our application and I want to generate a warning
        Better yet, it will help out future users, even though they didn't get your original memo ;-)