Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

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


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

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


Comment on Re^7: Order in which grep/map receive elements
Download Code
Re^8: Order in which grep/map receive elements
by abufct (Initiate) on Oct 06, 2012 at 06:05 UTC
    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

        If you wrapped the code you posted in a function and used it, you would be the author.
        then i would make my code bigger (and hence harder to maintain) without reason. the maintainer would need to read the code of my function, while he might be familiar with wide-spread library already. i do not like to add to this world's entropy. :-)
        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.
        Sounds quite sad. Why have such large amount of libs if you are afraid to use them? Maybe you're right and I will change my mind when I use perl for more time.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2014-12-23 01:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

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





    Results (133 votes), past polls