<html><body>
<p><font size="2" face="sans-serif">Hi "Llelan D.",</font><br>
<br>
<font size="2" face="sans-serif">In your text below, see the line marked in red. Would 'listfunctions()' before and after the 'exec' do what you need? (Apologies if that is too naive).</font><br>
<br>
<font size="2" face="sans-serif">Adrian.<br>
</font>
<table border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td class="t" width="178" valign="middle">
<ul style="padding-left: 1pt"><font size="2" color="#333333" face="Arial"><b>Adrian Weeks </b></font><font size="1" color="#666666" face="Arial"><br>
Development Engineer <br>
<br>
<br>
HID Global,<br>
3 Cae Gwyrdd,<br>
Green Meadow Springs<br>
Business Park,<br>
Cardiff CF15 7AB,<br>
United Kingdom.<br>
+44 (0)29 20528523 (Office)</font><font size="1" color="#0000FF" face="Arial"><u><br>
</u></font><a href="mailto:aweeks@hidglobal.com"><font size="1" color="#0000FF" face="Arial"><u>aweeks@hidglobal.com</u></font></a><font size="1" color="#0000FF" face="Arial"><u><br>
</u></font><a href="http://www.hidglobal.com/"><font size="1" color="#0000FF" face="Arial"><u>www.hidglobal.com</u></font></a></ul>
</td><td width="139" valign="middle">
<ul style="padding-left: 1pt"><a href="http://www.hidglobal.com/"><img src="cid:1__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" width="130" height="170" border="0"></a></ul>
</td></tr>
</table>
<br>
<br>
<img width="16" height="16" src="cid:2__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt="Inactive hide details for "Llelan D." ---09/07/2014 19:17:15---Thank you all for your kind replies. Samuel has come up with wha"><font size="2" color="#424282" face="sans-serif">"Llelan D." ---09/07/2014 19:17:15---Thank you all for your kind replies. Samuel has come up with what seems to be the only workable sol</font><br>
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">From:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<font size="1" face="sans-serif">"Llelan D." <LlelanD@TheSnakePitDev.com></font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">To:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<font size="1" face="sans-serif">users@lists.scilab.org</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Date:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<font size="1" face="sans-serif">09/07/2014 19:17</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Subject:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<font size="1" face="sans-serif">Re: [Scilab-users] Multiple files of functions with the same name</font></td></tr>
<tr valign="top"><td width="1%"><img width="96" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<ul style="padding-left: 4pt"><font size="1" color="#5F5F5F" face="sans-serif">Sent by:</font></ul>
</td><td width="100%"><img width="1" height="1" src="cid:3__=0FBBF782DFAA2B238f9e8a93df93869@prox.com" border="0" alt=""><br>
<font size="1" face="sans-serif">"users" <users-bounces@lists.scilab.org></font></td></tr>
</table>
<hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br>
<br>
<br>
<tt><font size="2">Thank you all for your kind replies. Samuel has come up with what seems <br>
to be the only workable solution using the namespaces provided by <br>
library variables (I'll explain after a couple of points and an example).<br>
<br>
----------<br>
The rest of the replies have to do with either loading and running each <br>
implementation sequentially, or manually renaming the loaded function <br>
variables.<br>
<br>
As I explained in the OP:<br>
* Both functions MUST be resident without clashing so they both can be <br>
run. Constantly reloading, re-interpreting, and recompiling each <br>
function for what may be millions of times per match is pathetically <br>
inefficient.<br>
* The .sci files might not only implement the specified function <br>
prototype, they might also implement many support functions. Since the <br>
implementation files might be written by 3rd parties (such as in a <br>
tournament), the support function names can not be known beforehand. So, <br>
it is impossible to know what to rename after an exec() is done, and <br>
</font></tt><tt><font size="2" color="#FF0000">I've never found a way to list what functions are loaded by an exec()</font></tt><tt><font size="2">.<br>
<br>
As to the confusion of what is being done: This is a description of a <br>
generic process that can be applied to a great variety of algorithm <br>
profiling and tournament situations. The overall products that might use <br>
this are not important. The ability to have functions with the same name <br>
and prototype implemented in different .sci files resident in the same <br>
session is.<br>
<br>
However, I'll give you a concrete example:<br>
Some years ago, a tournament was held for response algorithms to the <br>
Iterated Prisoner's Dilemma (see </font></tt><tt><font size="2"><a href="http://www.prisoners-dilemma.com">http://www.prisoners-dilemma.com</a></font></tt><tt><font size="2"> for <br>
details). Competitors would each implement a set of "personalities" each <br>
of which implements a "responseString = response(iGame, lastScore)" <br>
prototype. The tournament software expects to see in the tournament <br>
directory a set of directories each named for a competitor. In each <br>
competitor directory is a set of personality directories each of which <br>
holds the implementation of the response prototype function and possibly <br>
many other support functions. While the competitor names are registered <br>
unique, the personality and support function names might not be. Each <br>
competitor is paired against each other competitor where each <br>
personality of one competitor is played against each personality of the <br>
other 20 times. The average score for each personality and competitor is <br>
accumulated and the competitor(s) with the highest average score wins. <br>
With hundreds of competitors, some using dozens of personalities and <br>
many with the same names but different implementations, the number of <br>
games can easily run into the hundreds of thousands.<br>
<br>
In this scenario, the personalities should not be constantly reloaded, <br>
re-interpreted, and re-compiled for each and every call. The whole <br>
tournament would be uselessly bogged down.<br>
<br>
----------<br>
The library solution proposed by Samuel can deal with this since the <br>
loaded library functions can be qualified with the library variable <br>
name. For example: Two libraries are created in directories testLib1 and <br>
testLib2, each of which implements the "y = test(x)" prototype. After <br>
using the lib() function to load both to two variables called testLib1 <br>
and testLib2, you can call either testLib1.test(2) or testLib2.test(2) <br>
without having to reload anything. There is a little annoying magic <br>
where the variable "test" will be assigned to whatever library was last <br>
loaded but, if you do not use that variable, there is no problem, unless <br>
you run into variable space overruns (I do wish there was a way to not <br>
do that).<br>
<br>
For tournament software, it is important to be able to require <br>
competitors to submit implementation sources so that you can verify <br>
nothing goes on that breaks the rules. Scilab allows you to create the <br>
libraries without external utilities all in the same language. Setting <br>
funcprot(2) makes sure that competitor implementations do not try to <br>
futz with the environment used by the other competitor but still allows <br>
the qualified libraries with functions of the same name to be loaded. <br>
I've tested this and it works.<br>
<br>
Thank you Samuel for your solution to this. I am greatly appreciative.<br>
<br>
However – namespaces or qualified names are definitely needed in Scilab.<br>
<br>
_______________________________________________<br>
users mailing list<br>
users@lists.scilab.org<br>
</font></tt><tt><font size="2"><a href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a></font></tt><tt><font size="2"><br>
</font></tt><br>
<br>
</body></html>