<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello Pierre,<br>
<br>
Le 07/12/2016 10:04, Pierre Vuillemin a écrit :<br>
</div>
<blockquote
cite="mid:cbfcb36f4512700357decfbbca401ddf@pierre-vuillemin.fr"
type="cite">Hi all,
<br>
<br>
I have to create unique IDs for some object in Scilab. For that
purpose, someone kindly guided me towards the UUID class of java,
which lead me to create this function in Scilab,
<br>
<br>
function id = make_id()
<br>
UUID = jimport("java.util.UUID", %f)
<br>
tmp = jinvoke(UUID,"randomUUID")
<br>
id = jinvoke(tmp,"toString")
<br>
endfunction
<br>
<br>
It works fine.
<br>
<br>
An a priori similar function is
<br>
<br>
function id = make_id_err()
<br>
UUID = jimport("java.util.UUID", %f)
<br>
tmp = UUID.randomUUID()
<br>
id = tmp.toString()
<br>
endfunction
<br>
<br>
where the methods are called without jinvoke. While the
instructions of the latter function work well in the terminal,
they lead to an error when trying to exec the function
'make_id_err'.
<br>
<br>
I was wondering if it is a normal behaviour?
<br>
</blockquote>
<small><tt><big>No, but the bug is fixed in Scilab 6.0:<br>
</big><br>
In Scilab 5.5.2:<br>
-->endfunction</tt><tt><br>
</tt><tt> UUID = jimport("java.util.UUID", %f)</tt><tt><br>
</tt><tt> !--error 26 </tt><tt><br>
</tt><tt>Récursivité trop complexe ! (Les tables de récurrence
sont pleines)</tt><tt><br>
</tt><tt>at line 2 of function make_id_err called by : </tt><tt><br>
</tt><tt> tmp = UUID.randomUUID()</tt><tt><br>
</tt><tt>at line 3 of function make_id_err called by : </tt><tt><br>
</tt><tt> tmp = UUID.randomUUID()</tt><tt><br>
</tt><tt>at line 3 of function make_id_err called by : </tt><tt><br>
</tt></small>... etc<br>
<br>
In Scilab 6.0:<br>
<tt>--> getversion("scilab")</tt><tt><br>
</tt><tt>
ans =</tt><tt><br>
</tt><tt>
6. 0. 0. 1.477D+09</tt><tt><br>
</tt><tt>
<br>
--> function id = make_id_err()</tt><tt><br>
</tt><tt> > UUID = jimport("java.util.UUID", %f)</tt><tt><br>
</tt><tt> > tmp = UUID.randomUUID()</tt><tt><br>
</tt><tt> > id = tmp.toString()</tt><tt><br>
</tt><tt> > endfunction</tt><tt><br>
</tt><tt></tt><tt><br>
</tt><tt>--> make_id_err()</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> 49e4f3f1-736a-435f-bc26-f7061f10de27</tt><tt><br>
</tt><br>
BR<br>
Samuel <br>
</body>
</html>