Using: REXX-ooRexx_4.2.0(MT)_64-bit 6.04 22 Feb 2014    on W8.1, 64-bit

I ran a copy of the  'directory' class telephone-book example that's
example 5.166 in the Reference manual,
and tried to explore the 'unknown' method part of that more. According
to example 4.9 in section 4.2.6 on
"defining an unknown method" one can see both the method name and
original arguments on an unknown
method call, and that latter example shows:

::method unknown
expose target -- will receive all of the messages
use arg name, arguments
say name "invoked with" arguments~toString

so I ended up in my version of the telephone directory program with
mainline code:

say "Look-up by unknown index:"
say
say '- book["M"]'
say '-' book["M"]       /* -> "Mike H. ...... 555-6123, Mark C. ......
555-5017" */

say
say '- book~P'
say '-' book~P                          /* -> "No listing found for P"
*/

say
say '- book~Q(4,5)'
say '-' book~Q(4,5)                     /* -> "No listing found for Q"
*/

and was hoping that in my adapted unknown method code I'd be able to
access the arguments "4,5" shown 
on that last call.  My unknown method, activated by

book = .directory~new~~setMethod("UNKNOWN", .methods["LOOKUPUNKNOWN"])

(because unlike the example in the manual I wanted to differentiate
between the first and second parameters
of setMethod, which in the phone book example were both "UNKNOWN")
starts off with:

::Method lookupunknown
   use arg at_index, origargsarray
   say "lookupunknown: at_index="at_index
      say "lookupunknown: origargsarray:" origargsarray
   /* say "lookupunknown: origargsarray:" origargsarray~toString */

If I run that, output for the ~Q(4,5) call shows:
- book~Q(4,5)
lookupunknown: at_index=Q
lookupunknown: origargsarray: ORIGARGSARRAY

If I uncomment the line with  ~toString in it, I get

Error 97 running C:\Dropbox\JN_RexxExecs\test _JN_Common Code
Routines.rexp line 95:  Object method not found
Error 97.1:  Object "ORIGARGSARRAY" does not understand message
"TOSTRING"


If I change the method code to display at_index~class and
origargsarray~class, both tell me that those are "The String class".   

So, is example 4.9 in section 4.2.6 wrong, or have I misapplied it in my
method?                                                                  

-- 
Jeremy Nicoll - my opinions are my own.

------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to