is evaluation order defined, and evaluation of conditionals"and" to "or

dunbarx at aol.com dunbarx at aol.com
Tue Jun 26 00:38:31 EDT 2012


Jerry wrote":
similarly if "or" is used instead of "and",
> if the first part evaluates to "true", the second is NOT called.


"or" is a simpler case, as there is never a need to evaluate after
a first round "true". Again, at least externally.


I changed the "and" to "or" in Jerry's example, and if the left side yields "false" the right side is then evaluated.
 The language does seem to process booleans from left to right. All this makes sense externally.


I don't know why I thought it was somehow preocessed internally, with a boolean decision made at a lower level after
parsing the line as a whole, between two already evaluated terms.
LC just linearly goes along, merrily, almost, doing its thing step by step.


Craig Newman


-----Original Message-----
From: Dr. Hawkins <dochawk at gmail.com>
To: How to use LiveCode <use-livecode at lists.runrev.com>
Sent: Mon, Jun 25, 2012 11:57 pm
Subject: Re: is evaluation order defined, and evaluation of conditionals


On Monday, June 25, 2012, Jerry Jensen wrote:

>
> This behavior is guaranteed in the C language, but I don't know about
> guarantees in LiveCode. In C, similarly if "or" is used instead of "and",
> if the first part evaluates to "true", the second is NOT called. Again, I
> dunno about LiveCode. Exercise left to the reader (or somebody who knows!)


wow.  It's guaranteed to not be called?

OK, I retract my guess.

Then again, I guess that comes to the different purposes of C and modern
Fortran (I'm not sure what I said applies to F90; maybe F95 & later).
 Modern Fortan is designed for massive parallelism for math; offering to do
things in order would be counterproductive).


-- 
The Hawkins Law Firm
Richard E. Hawkins, Esq.
(702) 508-8462
HawkinsLawFirm at gmail.com
3025 S. Maryland Parkway
Suite A
Las Vegas, NV  89109
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

 



More information about the use-livecode mailing list