Bestfitting

When the interpreter is evaluating an expression in a given context κ and comes across a variable x to be evaluated, the bestfit definition of x must be chosen. This process consists of examining, for each definition, the context guard and Boolean guard for that definition. The applicable definitions are the ones for which the current context κ is enclosed in the context guard and for which the Boolean guard evaluates to true. The bestfit definition, should it exist, is the one applicable definition whose context guard defines a region completely (and strictly) contained inside the context guard of each of the other applicable definitions.

Bestfitting becomes more complicated when the predefined priority, deftime and validtime dimensions are introduced. Both deftime and validtime are natural numbers, referring to the same time line, while priority is a natural number meaning that the higher the priority, the higher the number. The priority and validtime dimensions are controlled by the programmer, while the deftime dimension is controlled by the interpreter. For example, for the equation


should #time be between 10 and 15, inclusive, then this equation is valid and has priority 2. The deftime for this equation is when it is added to the system.

The validtime dimension is simply used to restrict the context guard. However, the deftime and priority act differently, as they are ordered dimensions. Once all of the applicable definitions are found, then they are further restricted, first using the priority dimension, then the deftime dimension. For both these dimensions, higher numbers are favored.

Advertisements