The beginning of the chapter on control flow analysis in Principles of Program Analysis describes dynamic dispatch as being when variables can denote procedures.
To clarify, we could say that dynamic dispatch is whenever the actual procedure used in an invocation could at runtime originate from more than one procedure definition in the program. In a first order system, the name uniquely identifies the piece of code that will be used for the procedure. In a higher-order language, the operator can be an arbitrary expression, so its procedure body could come from any number of places in the program. Somewhere in between these two poles are OO languages such as Java where there is a fixed but non-trivial number of implementations of the procedure named in the invocation.
Of course, static analysis such as CFA might collapse certain cases to determine when there is only a single possible source location where the procedure can originate from, but we could perhaps say that dynamic dispatch is when you require a whole program analysis to determine which procedure will be used, if you can determine it at all.
Saturday, April 02, 2005
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment