<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello Dirk,<br>
<br>
Your question is funny, because it could be somewhat about the
typename() function, that has been simplified in Scilab 6:<br>
The syntax<span class="functionid"> <b>typename</b></span><b><span
class="default">(</span></b><b><span class="default">name</span></b><b><span
class="default">, </span></b><b><span class="default">type</span></b><span
class="default"><b>)</b> has been removed:</span><br>
5.5.2: <a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/5.5.2/en_US/typename.html">https://help.scilab.org/docs/5.5.2/en_US/typename.html</a><br>
6.0.0: <a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/typename.html">https://help.scilab.org/docs/6.0.0/en_US/typename.html</a><br>
<br>
IMO, it was in the top 5 most obscure feature of Scilab <6 :)<br>
I never saw any clear explanation nor example of usage about it
for 20 years.<br>
Maybe it was only silently failing:<br>
In Scilab 5:<br>
<tt>-->t = tlist(["test" "r"],%pi);</tt><tt><br>
</tt><tt>-->t.r</tt><tt><br>
</tt><tt> ans = </tt><tt><br>
</tt><tt> 3.1415927 </tt><tt><br>
</tt><tt>-->typename("test", 140)</tt><tt><br>
</tt><tt>-->type(t)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> 16. </tt><tt><br>
</tt><br>
Maybe the only really related (and not concluding) entry in the
whole Scilab knowledges database is:<br>
<a class="moz-txt-link-freetext" href="http://bugzilla.scilab.org/5621">http://bugzilla.scilab.org/5621</a><br>
<br>
But your question could also be about custom "typeof". Then, the
best entries are likely<br>
<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/tlist.html">https://help.scilab.org/docs/6.0.0/en_US/tlist.html</a><br>
and<br>
<a class="moz-txt-link-freetext" href="https://help.scilab.org/docs/6.0.0/en_US/mlist.html">https://help.scilab.org/docs/6.0.0/en_US/mlist.html</a><br>
<br>
Coming back to the example here-above:<br>
<tt>--> // Creating a new typeof object named "mytype"</tt><tt><br>
</tt><tt>--> // with fields "num", "bool", "poly", "txt"</tt><tt><br>
</tt><tt>--> t = tlist(["mytype" "num" "bool" "poly" "txt"]); </tt><tt><br>
</tt><tt>--> // Assigning initial values to fields</tt><tt><br>
</tt><tt>--> t.num = %pi;</tt><tt><br>
</tt><tt>--> t.bool = %f;</tt><tt><br>
</tt><tt>--> t.poly = (1-%z)^3;</tt><tt><br>
</tt><tt>--> t.txt = ["Hello" "Allo" "Hallo"]</tt><tt><br>
</tt><tt> t = </tt><tt><br>
</tt><tt> t(1)</tt><tt><br>
</tt><tt><br>
</tt><tt>!mytype num bool poly txt !</tt><tt><br>
</tt><tt><br>
</tt><tt> t(2)</tt><tt><br>
</tt><tt> 3.1415927</tt><tt><br>
</tt><tt><br>
</tt><tt> t(3)</tt><tt><br>
</tt><tt> F</tt><tt><br>
</tt><tt><br>
</tt><tt> t(4)</tt><tt><br>
</tt><tt> 2 3</tt><tt><br>
</tt><tt> 1 -3z +3z -z </tt><tt><br>
</tt><tt><br>
</tt><tt> t(5)</tt><tt><br>
</tt><tt>!Hello Allo Hallo !</tt><tt><br>
</tt><tt></tt><tt><br>
</tt><tt>--> typeof(t)</tt><tt><br>
</tt><tt> ans =</tt><tt><br>
</tt><tt> mytype</tt><br>
<br>
Nothing has changed between Scilab 5 and Scilab 6 about that.<br>
<br>
HTH<br>
Samuel<br>
<br>
<br>
Le 18/02/2017 à 14:02, Dirk Reusch a écrit :<br>
</div>
<blockquote cite="mid:20170218140230.69ab10af@lemon" type="cite">
<pre wrap="">Hello,
is there (apart from source code of Scilab itself) any
documentation/tutorial/example available, which provides
a good starting point on how to implement user-defined types
in the new Scilab 6.0?
Thanks,
Dirk
_______________________________________________
dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:dev@lists.scilab.org">dev@lists.scilab.org</a>
<a class="moz-txt-link-freetext" href="http://lists.scilab.org/mailman/listinfo/dev">http://lists.scilab.org/mailman/listinfo/dev</a>
</pre>
</blockquote>
<p><br>
</p>
</body>
</html>