Re: routine_id help
Oh, it might help to know that I'm running version 2.0. Then again, it =
might not...
----------
From: Roderick Jackson[SMTP:rjackson at csiweb.com]
Sent: Tuesday, February 16, 1999 10:47 AM
To: 'Euphoria'
Subject: routine_id help
Okay, I'm stuck again and I need to once more draw from the infinite =
Euphoria knowledge of the list.
Anytime I begin to think I understand "routine_id", it throws me a new =
curveball. I'm writing a library of routines that use "routine_id". One =
global routine in the library attempts to get the ID of any arbitrary =
user-defined function given to it. I've included the library file at the =
very top of my test program, then below the include I have my arbitrary =
functions, and finally my main procedure. For example:
------------------------
-- mock library...
------------------------
global function One ()
end function
-- more functions...
global function N (sequence FunctionName)
integer k
-- next line gets -1, even though the created function name is =
valid
k =3D routine_id (FunctionName & "_" & FunctionName)
-- and now it breaks...
return call_func (k, {})
end function
------------------
-- end library
------------------
---------------------
-- test program
---------------------
include library.e
global function MyFunction_MyFunction ()
-- process data...
return {}
end function
-- more functions...
procedure Main ()
object ReturnValue
-- process data...
-- next line crashes
ReturnValue =3D N ("MyFunction")
? ReturnValue
end procedure
Main ()
-------------------------
end test program
-------------------------
Now in my main procedure, I call the global library routine, and let it =
construct (correctly) the name of one of my non-library functions. But =
using "routine_id" to identify that name returns -1. I know the function =
being identified must be visible; yet both the function using =
"routine_id" and the one being identified are global. Am I still doing =
something illegal? Must the library include the user-defined functions =
in order to access them?
Rod Jackson
|
Not Categorized, Please Help
|
|