Task

The goal is to get the methods of an object, as names, values or both.

Some languages offer dynamic methods, which in general can only be inspected if a class' public API includes a way of listing them.

import system'routines;
import system'dynamic;
import extensions;
 
class MyClass
{
    myMethod1() {}
 
    myMethod2(x) {}
}
 
public program()
{
    var o := new MyClass();
 
    o.__getClass().__getMessages().forEach:(p)
    {
        console.printLine("o.",p)
    }
}