The METHODS Directory (.METHODS)

The .METHODS environment symbol identifies a directory (see The Directory Class) of methods that ::METHOD directives in the currently running program define. The directory indexes are the method names. The directory values are the method objects. See The Method Class.

Only methods and/or attributes that are not preceded by a ::CLASS directive are in the .METHODS directory. These are known as floating methods. If there are no such methods, the .METHODS symbol has the default value of .METHODS.


/* .methods contains one entry with the index (method name) "TALK" */
o=.object~enhanced(.methods)  /* create object, enhance it with methods */
o~talk("echo this text")  /* test "TALK" method */
::method talk  /* floating method by the name of "TALK" */
  use arg text  /* retrieve the argument */
  say text  /* display received argument */