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

[REBOL] Re: Reflectivity: How a function can know its own name ?

From: carl:cybercraft at: 27-Mar-2002 14:32

On 27-Mar-02, laplace wrote:
> If I don't have a "name of self" for function, each time I add a new > function to call generic function, it is in the code of generic > function that I would have to test the name of the function with a > more or less gigantic number of test instructions: > generic_function: make function ['function_name] > [ > if function_name = "func1" > [ > instruction11 > instruction12 > print function_name > instruction13 > ] > if function_name = "func2" > [ > print function_name > instruction21 > ] > ]
This doesn't address the function name problem, but there is a 'select word in View which would get around the need for multiple 'ifs. ie... item: 'blk-2 do select [ blk-1 [print "a"] blk-2 [print "b"] blk-3 [print "c"] ] item -- Carl Read