JPred: Practical Predicate Dispatch for Java "With predicate dispatch, a method implementation may specify an arbitrary predicate as a guard. A method m1 overrides another method m2 if m1’s predicate logically implies m2’s predicate. Ernst et al. provide a number of examples illustrating how predicate dispatch unifies and generalizes several existing language concepts, including ordinary OO dynamic dispatch, multimethod dispatch, and functional-style pattern matching."
"JPred augments the Java language by allowing each method declaration to optionally include a clause of the form when pred, just before the optional throws clause. The predicate expression pred is a boolean expression specifying the conditions under which the method may be invoked."
"While a traditional multimethod is expressed in JPred as a predicate consisting of a conjunction of specializer expressions on formals, JPred also allows arbitrary disjunctions and negations."
"Finally, a notion of resend [13, 37], which generalizes Java’s super to walk up JPred’s method-overriding partial order, could be useful to allow predicate methods within a class to easily share code."
No comments:
Post a Comment