CSC/ECE 517 Fall 2010/ch5 5c IC: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 1: Line 1:
<h1>'''Dynamic Dispatch'''</h1>
<div style='font-weight:bold; font-size:16pt; background-color:#708090; color:#ffffff; padding:5px; margin: 10px; 0px; 10px; 0px; text-align:center;'>Dynamic Dispatch</div>


==Introduction==
==Introduction==

Revision as of 01:22, 1 November 2010

Dynamic Dispatch

Introduction

Dynamic dispatch is an object-oriented programming concept that refers to the mapping of a method to an object's dynamic runtime type. It is common in many object-oriented languages. Languages such as Java and C++ use single dispatch, while only a few, such as CLOS, use multiple dispatch. Both types of dispatch will be discussed later.

Advantages

  • Flexibility
  • Extensibility

Disadvantages

  • Lookup overhead
  • Counter to safety and increased compile-time knowledge
  • Obstacle to optimization
  • Hinders compiler in determining exact type of objects

Single Dispatch

Multiple Dispatch

References

[1] S. Milton, H.W. Schmidt, “Dynamic Dispatch in Object-Oriented Languages”, 2004.

[2] M. Muller, “Message Dispatch in Dynamically-Typed Object-Oriented Languages”, Master’s Thesis, University of New Mexico, 1995.