Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^5: Order in which grep/map receive elements

by BrowserUk (Pope)
on Oct 05, 2012 at 13:37 UTC ( #997476=note: print w/ replies, xml ) Need Help??


in reply to Re^4: Order in which grep/map receive elements
in thread Order in which grep/map receive elements

Hm So you'll use the module in preference to the code you posted because it explicitly states ordering, despite knowing that it uses exactly the same code.

Erm. O-kay.


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.

RIP Neil Armstrong


Comment on Re^5: Order in which grep/map receive elements
Re^6: Order in which grep/map receive elements
by abufct (Initiate) on Oct 06, 2012 at 01:05 UTC
    Yes. If (when) this code stops working because of changes in perl, there will be a bug in the library. And this bug will be fixed (in a single place). I won't have to go through all my code and find all appearances of this code and fix it. I'd write my own function for that if I didn't have that module installed on our servers already.
      If (when) this code stops working because of changes in perl, there will be a bug in the library. And this bug will be fixed (in a single place).

      That is one of the most convoluted pieces of non-reasoning I've seen in a while.

      Firstly, assuming that grep will (or even might) suddenly change in a breaking and completely illogical way is like allowing for the possibility that the Sun might rise in the West tomorrow. A theoretical possibility, but distinctly unlikely.

      And even if grep did change; basing the correctness of your program on taking the statement that "The order of elements in the returned list is the same as in LIST.", as a guarantee, rather than just a statement of current reality, is naive in the extreme. What would you do if the author(s) decided "if its good enough for Perl, its good enough for us"? Sue.

      I won't have to go through all my code and find all appearances of this code and fix it. I'd write my own function ...

      The logic of putting common code in a subroutine -- the DRY principle -- is sound; but just as easily addressed by wrapping your posted code in a subroutine as it is by using a module.

      Using List::MoreUtils::uniq() is a perfectly valid choice for any of several reasons, but on the basis of some inferred guarantee, isn't one of them.


      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.

      RIP Neil Armstrong

        Basing correctness on current reality is definitely a bad idea. This leads to programs that can be compiled correctly with specific compiler version only, and programs that require specific version of runtime up to its minor version.
        If lots of people and code rely on that reality, then yes, maybe I can rely on it as well. That kind of answer would satisfy me. Several people answered my question and independently said that grep should work like that, so I am more confident in that now.
        What would you do if the author(s) decided "if its good enough for Perl, its good enough for us"?
        I don't know. If I were the author, I'd try to fix my lib, so that it worked like stated in the docs.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://997476]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2014-12-28 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (179 votes), past polls