http://qs1969.pair.com?node_id=98901


in reply to Re (tilly) 1: Operator Precedence
in thread Operator Precedence

Firstly, I think you have understated the positives of knowing the precedence table somewhat.

Secondly, even with the weight of the three positives you have mentioned, and no one is claiming any negatives to learning it. So the question is do the positives outweight the time investment of 2-3 hours? For anyone reading this I would say the answer is almost always yes.

I think my original statement has become a little side-tracked. My meditation is to memorize the precedence table - something a lot of us (even some of the best programmers) have not done.

Replies are listed 'Best First'.
Re (tilly) 3: Operator Precedence
by tilly (Archbishop) on Jul 23, 2001 at 07:48 UTC
    Please read, for a random example, the thread at RE: RE: Shot myself in the foot with a pos. My position from before when I arrived at PerlMonks is the same as it is now. There is a lot of stuff which I know that I rightly don't expect fellow programmers who are not primarily Perl programmers to know.

    This is not a position that everyone agrees with me on. Not even, by a long shot, all good programmers. (If you know anything about who is who in the Perl world, then you will know who chip is.) However in the real world there is a lot to say for my position.

    As for your position, huh? Do you really think that I have never looked at the precedence table? The fact that I don't advocate gratuitously abusing knowledge of it should not be taken as a sign of ignorance on my part. It is rather narrow-minded of you to assume that everyone who disagrees with you is more ignorant of this aspect of Perl than you are.

    Besides which, your assumption is wrong.

    My dislike of gratuitous abuse of operator precedence goes hand in hand with my dislike of using explicit positional logic when you don't have to. It is the same thing that leads me to write modularized code when I could write straight-line code for the task at hand. It has nothing to do with any inability on my part to do the things which I am avoiding. Instead it is my attempt to apply the principles that I believe lead to the most maintainable code for the environment that I am in.

    Now do I think it is useful to know the precedence table? Well yes. Knowledge is always good It is good to not be confused by quirks like the following:

    my %foo = "Hello", "World; print $foo{Hello};
    (Of course if you use warnings you will be pointed at the error without having to have the precedence table memorized. Funny how that works...)

    But I don't think that people should have to have the precedence table memorized to read my code. There are enough other things that they need to keep in mind which I consider more important...