|
August 1, 2000 Lazy Evaluation Tips: August 2000
Yehuda Shiran, Ph.D.
|
|
When implementing functional dependencies between properties, it is always a question when to trigger a recalculation following a change in one of the parameters. There are two opposite strategies. One says that you need to recalculate all parameters whenever one of the parameters or variables changes. The other one, sometimes called lazy evaluation, says that you need to compute a parameter only when you have to know its value. In such a methodology, a function is provided in case you want to force the evaluation.
In JavaScript, you can force a recomputation by calling the
In Column 65, Dynamic Properties, we showed how to program the Solar System. In this example, the need to update the location of the planet is implicit. None of the statements uses the
For more on Dynamic Properties, go to Column 65, Dynamic Properties.
People who read this tip also read these tips: Look for similar tips by subject: |