Suppose I embed a dynamically typed language on top of the JVM 7 that supports the invokedynamic
for binding methods at runtime.
The dynamically typed language has an add
function that works with integers, adding them to strings by concatenating them. Suppose now that add
is called, for example, by the processing of a general list, which knows (at compile time) that it contains objects, integers or strings, or both.
How can invokedynamic
help me here when compiling a method for the JVM bytecode, since it needs to send two different internal functions, namely the actual function that adds integers and the actual function that concatenates strings?
source share