Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Operator Precedence

by mattr (Curate)
on Jul 23, 2001 at 16:42 UTC ( #98991=note: print w/replies, xml ) Need Help??


in reply to Operator Precedence

For the reasons above, don't agree about your position. But I submit that the example you mention refers to the intelligent use of idiom and not the general case that is conjured up by your suggestion that Perl programmers should be considered illiterate unless they can perfectly apply the precedence tables in all situations, and that they should always want to do so to the fullest possible extent (a canard).

Perl is all about using (private) idiom to match personal style and increase efficiency. So in that sense I agree, example 3 seems easier to understand (to me). I think I've probably used all three examples in similar situations depending on how I thought about the problem, which is the point.

But the other two examples would be fine too if separated by whitespace/linefeeds, depending on temperament. This is a question not of how well someone knows precedence but about personal style. I am not sure that your personal style depends more on precedence rules than some other people here.

That said, I lost faith in the infallibility of precedence rules when I heard they were going to be "redefined". Maybe there is a fine (subjective) line between common knowledge and the esoteric in this case but as you can see from the comments everyone comes at Perl from a different angle and often there are good reasons for not exploiting that knowledge.

Replies are listed 'Best First'.
Re: Re: Operator Precedence
by mattr (Curate) on Jul 23, 2001 at 17:56 UTC
    Just thought I'd add this paragraph from Larry Wall's Natural Language Principles in Perl. I guess you could take it either way, but in the end I guess your own predilection is going to decide whether you find coding for ordinary folks useful or not. Anyway.

    No theoretical axes to grind

    Natural languages are used by people who for the most part don't give a rip how elegant the design of their language is. Except for a few writers striving to make a point in the most efficient way possible, ordinary folks scatter all sorts of redundancy throughout their communication to make sure of being understood. They use whatever words come to hand to get their point across, and work at it till they beat the thing to death. Normally this ain't a problem. They're quite willing to learn a new word occasionally if they see that it will be useful, but unlike lawyers or computer scientists, they feel little need to define lots of new words before they say what they want to say. In terms of computer languages, this argues for predefining the commonly used concepts so that people don't feel the need to make so many definitions. Quite a few Perl scripts contain no definitions at all. I dare you to find a C++ program without a definition.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2021-10-24 15:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?