[REBOL] Re: Reflectivity: How a function can know its own name ?
From: laplace::worldnet::fr at: 26-Mar-2002 19:54
Hello thanks for the code. I will be useful for me since I just began to
look at Rebol.
Nevertheless my problem is in fact to know the name of the function FROM
INSIDE the function because I want to do something like this (see my first
anwer to the thread I suppose that an instruction name of self is
implemented for rebol function):
generic_function: make function ['function_name]
[
print function_name
]
func1: make function! [ instruction11 instruction12 generic_function [name
of self] instruction13]
func2: make function! [generic_function [name of self] instruction21 ]
...
func10: make function! [ instruction31 generic_function [name of self]]
----
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
]
]