Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Mumps > Re: The `if' co...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 5 of 26 Topic 956 of 990
Post > Topic >>

Re: The `if' command

by Rob Tweed <rtweed@[EMAIL PROTECTED] > Apr 30, 2008 at 09:27 PM

If PG is forbidden, let me comment.  ****d references are at best a
daft invention and at worst just plain evil, and are to be avoided at
all costs.  Stick to explicit global references or you'll end up with
an incomprehensible, unmaintainable mess.  I'm sure someone somewhere
will wade in with a wall of flame to extol their arcane virtues but
I've never encountered a single situation in 28 years where they made
any sense whatsoever.

On Wed, 30 Apr 2008 10:36:19 -0500, "Maury Pepper"
<mpepper_scram_spam@[EMAIL PROTECTED]
> wrote:

>You are correct.  Normally, I would write: if i<j&(k>j) write ...  but
the & 
>provides an op****tunity to split the if into two parts as:
>if i<j,k>j write ...  Only if the first argument "i<j" is true does the 
>second argument "k>j" get evaluated.  It has the effect of an AND
operator 
>but there are a couple of differences you should be aware of:  1) it's 
>faster, and that's generally the appeal of splitting up the expression;
and 
>2) because later expressions are not evaluated once an expression is 
>evaluated as false, you may not get the side effects that you were
counting 
>on.  For example:
>  IF X>Y&$D(^Z(W)) WRITE ^(W)
>  ELSE  WRITE ^(V)
>This counts on executing the $D(^Z(W)) in order to set up the ****d 
>reference.  If the & is replace by a comma and X is not greater than Y,
then 
>the $D won't be executed and the  ELSE will likely fail. (Please, no 
>comments from the PG regarding the use of ****d references!)
>
>
>
>"Duke Normandin" <dukeofperl@[EMAIL PROTECTED]
> wrote in message 
>news:W8ZRj.3383$XI1.311@[EMAIL PROTECTED]
>> On 2008-04-30, Maury Pepper <mpepper_scram_spam@[EMAIL PROTECTED]
> wrote:
>>> There is no operator precedence in Mumps so the expression "if
i<j&k>j" 
>>> is
>>> evaluated as:
>>>  if (((i<j)&k)>j)
>>> Since 1 is less than 2, the first term is true, and "true" has the
value 
>>> 1.
>>> Since 1 & 3 is true, the second term is true, ie = 1.
>>> Since 1 is not greater than 2, the third term is false.
>>
>> I see now! The moral of the story then is:
>>
>> Put the parentheses where _you_ want/need them and _never_ rely on
Mumps
>> to do it! ;)
>> Thanks!!
>>
>>> "Duke Normandin" <dukeofperl@[EMAIL PROTECTED]
> wrote in message
>>> news:pURRj.3093$PM5.3083@[EMAIL PROTECTED]
>>>> set i=1,j=2,k=3
>>>>write "yes",!
>>>>
>>>> i _is_ less than j AND k _is_ greater than j
>>>>
>>>> so why is _yes_ NOT printed?
>>>>
>>>> The logical operator & tells me that both relational expressions must
>>>> be true in order for the _yes_ to be printed. That's exactly what it
is,
>>>> so what am I missing? TIA......
>>>> -- 
>>>> Duke Normandin
>>
>> -- 
>> Duke Normandin 

---

Rob Tweed
Company: M/Gateway Developments Ltd 
Registered in England: No 3220901
Registered Office: 58 Francis Road,Ashford, Kent TN23 7UR

Web-site: http://www.mgateway.com

SlipstreamUSA: April 2, Renaissance Hotel, Orlando  
http://www.OutOfTheSlipstream.com
 




 26 Posts in Topic:
The `if' command
Duke Normandin <dukeof  2008-04-30 03:42:13 
Re: The `if' command
"Maury Pepper"   2008-04-29 23:04:08 
Re: The `if' command
Duke Normandin <dukeof  2008-04-30 11:57:42 
Re: The `if' command
"Maury Pepper"   2008-04-30 10:36:19 
Re: The `if' command
Rob Tweed <rtweed@[EMA  2008-04-30 21:27:44 
Re: The `if' command
Duke Normandin <dukeof  2008-05-01 03:09:48 
Re: The `if' command
"Maury Pepper"   2008-05-01 00:01:48 
Re: The `if' command
Duke Normandin <dukeof  2008-05-02 00:01:24 
Re: The `if' command
Duke Normandin <dukeof  2008-05-01 03:00:26 
Re: The `if' command
Philip Gage <philip@[E  2008-04-30 16:12:07 
Re: The `if' command
Duke Normandin <dukeof  2008-05-01 03:19:45 
Re: The `if' command
Rilian <noway@[EMAIL P  2008-05-01 07:32:10 
Re: The `if' command
Duke Normandin <dukeof  2008-05-02 00:05:07 
Re: The `if' command
"Maury Pepper"   2008-05-01 21:01:16 
Re: The `if' command
Pete <peter.charbonnie  2008-05-01 17:47:45 
Re: The `if' command
Duke Normandin <dukeof  2008-05-02 11:59:01 
Re: The `if' command
Aaron Seidman <aaron@[  2008-05-02 09:20:37 
Re: The `if' command
Duke Normandin <dukeof  2008-05-03 00:25:53 
Re: The `if' command
rodd@[EMAIL PROTECTED] (  2008-05-02 17:41:04 
Re: The `if' command
Duke Normandin <dukeof  2008-05-03 03:07:17 
Re: The `if' command
rodd@[EMAIL PROTECTED] (  2008-05-04 04:56:29 
Re: The `if' command
Duke Normandin <dukeof  2008-05-04 13:57:45 
Re: The `if' command
Pete <peter.charbonnie  2008-05-02 07:28:00 
Re: The `if' command
Duke Normandin <dukeof  2008-05-03 03:23:52 
Re: The `if' command
Rob Tweed <rtweed@[EMA  2008-05-03 12:07:07 
Re: The `if' command
"don" <faydo  2008-05-08 10:04:30 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sun Jul 20 0:15:32 CDT 2008.