How to filter results of a virtual method?

John Rose john.r.rose at oracle.com
Sun Jan 30 01:35:51 PST 2011


On Jan 27, 2011, at 7:09 PM, Kirill Shirokov wrote:

> By the way, why exactInvoker() is needed? Isn't the following true?
> 
> exactInvoker(target.type()).bindTo(target) == target

That is true (modulo behavioral equivalence).

An exact invoker is useful in other settings besides bindTo.  It corresponds to the invocation of C function pointers, (*...)(...) in (*f)(a,b).

For example, if you want to emulate a dispatching indirect function call (*g(a))(a,b), you use MHs.foldArguments to transform (*f)(a,b) by replacing f by g(a).  The 'combiner' argument is the dispatcher g and the 'target' is an invoker.  If the dispatcher can return exactly-typed results (the f=g(a)), then an exact invoker is best.  In any case, a generic invoker works.

-- John


More information about the mlvm-dev mailing list