[EMAIL PROTECTED] wrote:

> To sum up thus far, it appears that handling these three cases
> 
> 1)  same object, same method, computed argument(s)
> 2)  same object, computed method, same argument(s)
> 3)  computed object, same method, same argument(s)
> 
> involves the use of three (radically!) different techniques.  I'm
> very grateful for the responses thus far.  I would be even happier
> if we could come up with a single general approach that would
> handle all three of these cases.

This is the best I can think of:

>> do-meth: func [obj [object!] meth [word! path! block!] args [block!]] [
[    do compose [(to-path compose [obj (to-block :meth)])
(args)]           
[   
]                                                                      
>> do-meth obj 'f [1]                                                     
1 none none
>> do-meth obj 'f/ref [1 2]                                               
1 true 2
>> do-meth obj compose [f (pick [ref []] random 2)] [1 2]  
1 true 2
>> do-meth obj compose [f (pick [ref []] random 2)] [1 2]
1 none none
== 2
>> do-meth obj compose [f (pick [ref []] random 2)] [1 2]
1 none none
== 2
>> do-meth obj compose [f (pick [ref []] random 2)] [1 2]
1 none none
== 2
>> do-meth obj compose [f (pick [ref []] random 2)] [1 2]
1 true 2

Regards,
   Gabriele.
-- 
Gabriele Santilli <[EMAIL PROTECTED]> - Amigan - REBOL programmer
Amiga Group Italia sez. L'Aquila -- http://www.amyresource.it/AGI/

Reply via email to