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.

#! instance_methods(m, n, o)
#! instance_properties(p, q, r)
class C {
   construct new() {}
 
   m() {}
 
   n() {}
 
   o() {}
 
   p {}
 
   q {}
 
   r {}
}
 
var c = C.new() // create an object of type C
System.print("List of instance methods available for object 'c':")
for (method in c.type.attributes.self["instance_methods"]) System.print(method.key)