in reply to Re^6: Clever vs. Readable
in thread Clever vs. Readable

always-has-been-and-(probably)-always-will-be-and-would-break-half-of-CPAN-if-it-ever-changed behaviour isn't explicitly documented isn't one of them.

Obviously. That wasn't the point.

You mean like: testing?

Creating a test doesn't help the reader understand there are no hidden motives.

The "claim" as you term it, applies to perl, not arbitrary modules.

I thought we were talking about Perl's relational operators.

Replies are listed 'Best First'.
Re^8: Clever vs. Readable
by BrowserUk (Patriarch) on Aug 10, 2008 at 03:44 UTC
    Creating a test doesn't help the reader understand there are no hidden motives.

    Don't restrict "testing" to "creating a test". When I don't understand something I read in a piece of code, I run a few tests until I do.

    Beyond that, I'm not going to spend time defending idioms that have no advantage over the simple alternative. Not even a golfing advantage. Once you remove the common elements, you get ?: vs. [,]->[] vs. (,)[]

    With no golfing advantage; no performance advantage; no evaluate the arguments once advantage; and no clarity advantage. I see lots of good reasons for eshewing the idioms, without reference to an 'it ain't never going to happen' justifiction.

    I thought we were talking about Perl's relational operators.

    A couple of examples from IO::All's pod:

    io('file.txt') > $contents; $contents < io 'file.txt';

    I don't think that there is any way that you could claim those to be examples of "Perl's relational operators"?

    Even if the overloading module deals with numerical quantities and overloads those symbols to performs comparisons of those quantities, if its author chooses to forgoe tradition, example and existing practice and return, say, "0 but true" instead of 1, then I don't think that you can lay the blame for that at Perl's door.

    Obviously. That wasn't the point.

    You say that the point of stating "<= is not documented to return 1 when true." is not that the " behaviour isn't explicitly documented". Then perhaps you could explain what the point of the statement was?


    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.

      I don't think that there is any way that you could claim those to be examples of "Perl's relational operators"?

      No, I don't. But if an overloaded relational operator acted as a relational operator (i.e. returned a true or a false value), wouldn't that be a relational operator?

      then I don't think that you can lay the blame for that at Perl's door.

      I never blamed Perl. I blamed the clever code that ignored the documentation.

      Don't restrict "testing" to "creating a test". When I don't understand something I read in a piece of code, I run a few tests until I do.

      The same answer applies. Readability and thus the value of the code is severely hindered if you need to run tests to understand something basic.

      And what test will tell me that "it always has returned 1", the answer I'm expected to reach according to this thread?

      Then perhaps you could explain what the point of the statement was?

      I tend to forgot to follow through to the conclusion of my point in writing,. See replies to see where I was leading.

        Most of that is just noise, but one point needs picking up.

        1. How would a module author's choice to return a non-standard value for true, be caused by "clever code ignoring the documentation"?
        2. How do you ignore what isn't written?

          Does that make me rude for not saying hello to the ghost I didn't see?


        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.