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.

 
# The Rectangle class
(class +Rectangle +Shape)
# dx dy
 
(dm T (X Y DX DY)
   (super X Y)
   (=: dx DX)
   (=: dy DY) )
 
(dm area> ()
   (* (: dx) (: dy)) )
 
(dm perimeter> ()
   (* 2 (+ (: dx) (: dy))) )
 
(dm draw> ()
   (drawRect (: x) (: y) (: dx) (: dy)) ) # Hypothetical function 'drawRect'
 