in reply to Re^5: Anybody use !!
in thread Anybody use !!

I take it you've guessed where this is going, but I'll spell it out anyway.

If you've learnt to understand it, why do you assume others will be unable to?

This attitude always reminds of those news reports on some scientific story where the reporters dance all around the subject using dozens of words trying to avoid the one word that exactly describes what they are trying to say, but they feel is "too difficult for the general public".

If they just used the word, anyone interested enough would look it up. Anyone else probably won't listen to the attempts to avoid it anyway.


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.

Replies are listed 'Best First'.
Re^7: Anybody use !!
by Marshall (Canon) on Dec 30, 2010 at 10:59 UTC
    "If you've learnt to understand it, why do you assume others will be unable to?"

    That was not the point. Where this got started, I said that !!$return is a bad idea. The statement essentially returns a flag (boolean) value. Some prior statement should have made to make the return value crystal clear and given it another name other than $return: like $all_accounts_valid or whatever fits the application.

    So the first style point is that $return doesn't describe what it is. Yes it is a return value, but what kind of return value? One line of code before the return was needed in my opinion to turn this into a boolean return value.

    If you don't agree that using a better name than $return is "easier to understand" and a better style, then things degenerate from there and I have no hope of convincing you otherwise. And yes this will require one statement before the return to make this clear. But..

    return $all_data_valid; is better in my opinion than:
    return !!$return; There is no need for this confusing !!$return.

    This is not a point of whether !!$return can be understood, the point is that there are easier ways of expressing this idea so that it can be easily understood. A Perl return scalar doesn't have a type declaration like in C. Often that very last return line has a lot of contextual meaning. returning a flag like: $all_data_valid is just going to convey more information than !!$return.

      Oh, okay. I guess I misunderstood the OP. I thought that he named the variable $return because it was unimportant to his question.

      I can see that if you speculate about the bigger picture, the name of the variable is important:

      sub isAllDataValid { my $return; if( ... ) { $return = thisTest(...); } elsif( .. ) { $return = thatTest(...); } else{ $return = theOthertest(...); } ... return !! $return; }

      And the normalisation of disparate returns is relatively unimportant.


      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.
      Don't feed the BUKs...

      ... and a happy new year! :)