Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] source fails for object function

From: pat665::ifrance::com at: 10-Dec-2001 21:56

Hi all, I have used 'source to verify that two functions were identical. However this technic fails for object function. This small script shows this. Rebol [] a: func [n [integer!]] [ 2 * n ] b: :a obj: make object! [ myfunc: none ] c: func [n [integer!]] [ 3 * n ] obj/myfunc: :c print obj/myfunc 3 ; works ! source a source b source c source obj/myfunc ; fails ! ** Script Error: source expected word argument of type: word ** Where: do-boot ** Near: source obj/myfunc This leads to several questions : - why does source fail ? - how one can test if two functions are identical ? - is the >> obj/myfunc: :c << a correct way to reference external function ? - is there any other way to do that ? BTW as it is not much obvious the goal is to reference a function in an object. The context is that my object holds the main logic of the program, but I want it independant of the display functions. So display functions are defined externally. However the object must be able to display some stuff too so it has some function "pointers" (if I can say so). Patrick nb : I posted this yesterday, but it seems to have vanished away, because I did not receive it back.