I am trying to use the .Object setMethod() on a stem in order to dump the content of the stem in a certain format. Any help is appreciated.
This is what I tried:

------------------
  recs.1 = 'aaa'
  recs.2 = 'bbb'
  recs.~setMethod('dump', .methods~dumpCollection)
  say recs.~dump
exit

/**
 * floating method
 */
::method dumpCollection
  mb=.MutableBuffer~new;
  loop i over self~allindexes~sort;
      if i = 'DUMP' then
          iterate;
      mb~append(self~class~id'['i']:'self[i]||.Endofline);
  end;
 
  return mb~string
-------------------------

and this is what I get:
     5 *-* recs.~setMethod('dump', .methods~dumpCollection)
Error 97 running C:\Keita\REXX\sandbox\testSetMethod.rex line 5:  Object method
not found
Error 97.1:  Object "RECS." does not understand message "SETMETHOD"

However, replacing the stem by a .Directory does work fine.

Cheers,
Madou