Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by abufct (Initiate)
on Oct 06, 2012 at 01:05 UTC ( #997556=note: print w/ replies, xml ) Need Help??


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

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.


Comment on Re^6: Order in which grep/map receive elements
Re^7: Order in which grep/map receive elements
by BrowserUk (Pope) on Oct 06, 2012 at 05:03 UTC
    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.
        If I were the author, I'd try to fix my lib,

        If you wrapped the code you posted in a function and used it, you would be the author.

        And would not be reliant upon the good will; the agreement (or not) with you; motivation and timeliness; or continued existence; of some stranger you've never met.

        Or worse those same attributes of the latest maintainer, who may decide to take the module in a completely different direction. Something that has happened to me at least 4 times in the last 5 years.


        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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2014-09-21 00:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (165 votes), past polls