[Scilab-users] Multiple files of functions with the same name

Llelan D. LlelanD at TheSnakePitDev.com
Thu Jul 3 04:14:13 CEST 2014


A common task I've coded is to run multiple implementations of the same 
function head-to-head to profile their effectiveness. An example would 
be a competition in which each of two implementations provide a response 
for each match. The usual way in other interpreted languages is to have 
the implementers write a source file implementing the same function 
prototype (same name, arguments, and return type). You load each one in 
their own namespace and run each for each match.

Is there a way to load the functions in two .sci files so that the 
second does not clobber the first. I can find no system for qualifying 
function names or creating namespaces in Scilab. The files can not be 
run in-place (without persisting in the session) since the exec() 
function only loads the functions and does not run any. Using statements 
outside of any function does no good as additional function definitions 
might be required in the file to implement their algorithm.

I've thought of using exec() on one file, qualifying the loaded function 
names with <unique competitor name>_<function name> with assignments and 
clearing the original function variables (which works manually), and 
doing the same for the second file but I can find no way of getting a 
list of functions loaded by the last exec().

I'm either missing something really obvious or am stymied. Any help 
would be greatly appreciated.



More information about the users mailing list