Previous: SEX Operators, Up: Selection Expressions

3.5.4 Evaluation of Selection Expressions

Given that:

It is clear that some backtracking mechanism is needed in the evaluation of the selection expressions. For example, consider the following expression that is deciding whether a “registration” in a webpage should be rejected:

     ((Email ~ "foomail\.com") || (Age <= 18)) && !#Fixed

The previous expression will be evaluated for every possible permutation of the fields “Email”, “Age” and “Fixed” present in the record, until one of the combinations succeeds. At that point the computation is interrupted.

When used to decide whether a record matches some criteria, the goal of a selection expression is to act as a boolean expression. In that case the final value of the expression depends on both the type and the value of the result launched by the top-most subexpression:

Sometimes a selection expression is used to compute a result instead of a boolean. In that case the returned value is converted to a string. This is used when replacing the slots in templates (see Templates).