Product SiteDocumentation Site

6.14. The METHODS Directory (.METHODS)

The .METHODS environment symbol identifies a directory (see Section 5.3.9, “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 Section 5.1.4, “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.

Example 6.2. .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 */