Interface IPredicateExpression

Assembly: redb.Route.dll

An expression that defines its own reading in a condition, rather than being evaluated to a
value and read for truthiness.

public interface IPredicateExpression : IExpression

Methods

Matches(IExchange)

Evaluates the expression in a condition position.

bool Matches(IExchange exchange)

Remarks

A query language brings a notion of a match that evaluating-then-reading cannot reconstruct.
XPath("/order/discount") in a condition asks whether the path matched; flattening the
node-set to a value first answers with the node's content instead, so
<discount>0</discount> would read as "no match". Implementing this interface
keeps that decision where the language's semantics live.


It deliberately does not extend . Condition-taking verbs are
overloaded on and both, so an expression that
implemented the latter would make Filter(XPath("/a/b")) an ambiguous call — the language
would gain a semantics and lose the spelling that needed it.