Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Re: Operator Precedence

by scott (Chaplain)
on Jul 22, 2001 at 23:30 UTC ( #98859=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Operator Precedence
in thread Operator Precedence

I claim that the two conditions don't look the same. They do to the compiler of course, but not to me.

In this case the second tells me the intent of the command whereas the first only tells me the command.

The purpose of the extra parentheses isn't to instruct the compiler, it is to instruct me. And it's not to instruct me in what specific sequence of operations the compiler is being told to execute, but to tell me something about the real problem being solved, i.e. 'is the point in the box?'.

And this is a diferent question than 'Is X both less than the maximum x and greater than the minimum x while at the same time, Y is less than the maximum y and greater than the mimimum y?'

You may ask, well, if the compiler thinks they're the same, then what's the difference? Or you may not, but let's assume you did. :)

I answer that source code is meant to be read by the compiler *and* humans. It therefore must serve two purposes, to correctly instruct the processor in the sequence of operations to be performed, and to instruct the human who reads it.

Many humans find 'Is the point in the box?' far more digestible than 'Is X less than ... and ... and ... '

For me, the 'documentary' parentheses make if far easier to see the question as an instance of the first and not the second.

Log In?
Username:
Password:

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

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







    Results (89 votes). Check out past polls.

    Notices?