Predicate dispatch

In computer programming, predicate dispatch is a method of runtime polymorphism that generalises multiple dispatch ("multi methods"),that allows method calls to be selected at runtime based on arbitrary decidable logical predicates and/or pattern matching attached to a method declaration.[1]

Julia has a package for it with PatternDispatch.jl but otherwise natively supports multiple dispatch.

Experimental implementations have been created for Common LISP,[2][3] and for Java (JPred[1]).

It allows open extension of previously declared methods at a fine-grained level, but multiple extensions with identical or overlapping predicates created by different developers may interfere with each other in unanticipated ways. In this respect it is similar to aspect-oriented programming.

References

  1. 1 2 Millstein, T.; Frost, C.; Ryder, J.; Warth, A. (2009). "Expressive and modular predicate dispatch for Java". ACM Transactions on Programming Languages and Systems. 31 (2): 1. doi:10.1145/1462166.1462168.
  2. "Predicate Dispatching in Common Lisp Object System" (PDF).
  3. "pcostanza/filtered-functions". GitHub. Retrieved 2016-04-07.

External links


This article is issued from Wikipedia - version of the 6/12/2016. The text is available under the Creative Commons Attribution/Share Alike but additional terms may apply for the media files.