Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
True or False
Message
From
16/01/2007 11:09:14
 
 
To
16/01/2007 10:55:53
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01185857
Message ID:
01185918
Views:
11
>>>>We now know we were wrong and why. But does anybody here (except Sergey, who obviously appears to know why) know why?
>>>
>>>The precedence of AND means that AND is evaluated first (like multiplication) and then the OR (like addition). So your expressions basically read as
>>>
>>>
? .f. or .t. or (.f. and .f.) or .f.
>>>? .f. or .f. or (.t. and .f.) or .f.
>>>
>>>The precedence of conjunction over disjunction makes parentheses unnecessary, hence they need not be written. It always behaves as if they are.
>>
>>Yes, you are right. Nevertheless, my suggestion to other developers is to use the parentheses anyway. I always use the (formally unnecessary) parentheses anyway and today I was confronted with a piece of source code without the parentheses. It initially really puzzled me.
>
>You're not the only one - I've seen here on UT logical expressions where parentheses were added for clarity. Let's face it, a logical expression with five terms or more is not exactly a roadsign to be understood in a millisecond. And for many people it's a bit over their head.
>
>I once had a case of a logical expression which extended over eight lines (in Cobol :). It took me good ten minutes to reduce it to an equivalent two-liner. The person who wrote that was an economist. That taught me that while I have the feeling the logical expression are easy to do, I may not share that feeling with all the people :).

The same is true for the expressions after WHERE, FOR, CASE and so on. It is my habit to present all combined ´parts´ of the expression not only between parentheses, but also on separate lines. Example:
select ;
   * ;
   from sometable ;
   where nose > 4_inch ;
   or    mouth > 3_inch ;
   or    ( ears > 5_inch and hair > 30_inch ) ;
   or    hand > 10_inch ;   
   into cursor c_table
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform