Hi, I'm trying to find a decription of what I believe is a common pattern in numerical computation (and possibly occurs in a modified form in language evaluation), but don't know how to get started. Given the description below does anyone know what it might be, or alternatively, can anyone point me at a way for finding patterns? I hope this is an appropriate use of this list.
Thanks, Andrew The aim of the pattern is to evaluate a number of expressions which are defined in terms of each other and some shared state. For example, the shared state may be the parameters of a model that is being optimised, and the expressions calculate observed quantities used to assess the model against measurements. The structure of the pattern separates the expressions from a central "environment" that includes the state, a cache of evaluated expressions, and an "evaluator". Evaluation is driven by requesting the expression values from the evaluator in the environment. The evaluator checks the cache and, if the expression is not yet known, passes the environment to the expression. The expression then requests the values it needs from the evaluator, calculates its own value, and returns. The action of requesting values from the environment/evaluator may cause other expressions to be evaluated and cached, recursively. The advantages of the pattern are: - separating the state from the expressions gives easy extension - the automatic resolution of dependencies between expressions - efficient evaluation via caching The main risk is a circular loop where two expressions depend each on the other. One way to avoid this is to force the initial system to be constructed incrementally with no forward references. I'm looking for a description because I'm curious about the bst way to structure some details - what is the best way to relate teh evaluator and cache, and should the expressions and state share the same API for access - as well as a reference to pass to colleagues when they look at the code and ask what's happening. _______________________________________________ patterns-discussion mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/patterns-discussion
