Many programming languages include some notion of dispatch. In such languages, a message name is bound to a set of possible implementations. A dispatch mechanism selects the implementation which is deemed the most appropriate at any given dynamic call site. There are two questions a dispatch mechanism must answer:
Predicate dispatching expresses this idea directly. The question of applicability is answered by providing an explicit predicate, a boolean formula over class tests and program expressions, along with each implementation. An implementation is applicable precisely when its predicate evaluates to true. The most specific implementation is the member of the applicable set that overrides all others, where overriding is expressed in terms of logical implication between predicates.
This mechanism subsumes previous dispatch mechanisms such as object-oriented single and multiple dispatch, pattern matching, predicate classes and classifiers.
For more information about predicate dispatching, please see our ECOOP'98 paper Predicate Dispatching: a Unified Theory of Dispatch.
Browse the on-line user's manual for
Güd, also known as Dubious With Predicate
Dispatching.
Download the distribution;
Güd is an interpreter written in Java.