RE: Back to Adoption Barriers (was Re: Applescript Studio announc ed today!)
RE: Back to Adoption Barriers (was Re: Applescript Studio announc ed today!)
- Subject: RE: Back to Adoption Barriers (was Re: Applescript Studio announc ed today!)
- From: John W Baxter <email@hidden>
- Date: Thu, 27 Sep 2001 15:11:30 -0700
At 13:38 -0700 9/27/2001, Zavatone, Alex wrote:
>
Helmut:
>
>
P.S. In case somebody doesn't know what significance "lazy evaluation" has:
>
>
It simply means that AppleScript stops to work on a calculation, when
>
the outcome of it is already clear. Even if there's still unprocessed
>
data.
>
>
As AppleScript IS lazy evaluating boolean expressions (and does this
>
from left to right AFAIK) you can excecute the following with no
>
error:
>
true or 1/01
>
--> true
>
>
Me:
>
I think you are implying short circuiting the expression right? Where in "x
>
and y or z", there is no reason to process the or if the and is already
>
proven false.
>
>
Or maybe my terminology is wrong.
>
- Zav
Helmut was describing what I learned as "short circuit evaluation". "Lazy
evaluation" I learned as...let's put off this long computation until we
really need the value the first time.
As in
set spam to --some longish computation
if ... then
--spam's value is needed here
else
--spam's value is not needed here
end if
versus
set spam to missing value
if ... then
if spam is missing value then
--set spam to --some longish computation
end if
-- use spam's value
else
--we never needed to bother computing spam's value
end if
(Note that the whole latter nested if could be inside a loop, and spam's
value would be computed only once, and only if needed by at least one pass
through the loop.)
--John (people with other learning paths may well have learned other terms)
--
John Baxter email@hidden Port Ludlow, WA, USA