Task

Invoke an object method where the name of the method to be invoked can be generated at run time.



Related tasks

 Respond to an unknown method call.
 Runtime evaluation


import extensions;
 
class Example
{
    foo(x)
        = x + 42;
}
 
public program()
{
    var example := new Example();
    var methodSignature := "foo";
 
    var invoker := new MessageName(methodSignature);
    var result := invoker(example,5);
 
    console.printLine(methodSignature,"(",5,") = ",result)
}