[Scilab-Dev] Scilab 6.0 // Implementation of user-defined types
Samuel Gougeon
sgougeon at free.fr
Tue Feb 21 21:44:40 CET 2017
Hello Dirk,
Your question is funny, because it could be somewhat about the
typename() function, that has been simplified in Scilab 6:
The syntax*typename**(**name**, **type**)* has been removed:
5.5.2: https://help.scilab.org/docs/5.5.2/en_US/typename.html
6.0.0: https://help.scilab.org/docs/6.0.0/en_US/typename.html
IMO, it was in the top 5 most obscure feature of Scilab <6 :)
I never saw any clear explanation nor example of usage about it for 20
years.
Maybe it was only silently failing:
In Scilab 5:
-->t = tlist(["test" "r"],%pi);
-->t.r
ans =
3.1415927
-->typename("test", 140)
-->type(t)
ans =
16.
Maybe the only really related (and not concluding) entry in the whole
Scilab knowledges database is:
http://bugzilla.scilab.org/5621
But your question could also be about custom "typeof". Then, the best
entries are likely
https://help.scilab.org/docs/6.0.0/en_US/tlist.html
and
https://help.scilab.org/docs/6.0.0/en_US/mlist.html
Coming back to the example here-above:
--> // Creating a new typeof object named "mytype"
--> // with fields "num", "bool", "poly", "txt"
--> t = tlist(["mytype" "num" "bool" "poly" "txt"]);
--> // Assigning initial values to fields
--> t.num = %pi;
--> t.bool = %f;
--> t.poly = (1-%z)^3;
--> t.txt = ["Hello" "Allo" "Hallo"]
t =
t(1)
!mytype num bool poly txt !
t(2)
3.1415927
t(3)
F
t(4)
2 3
1 -3z +3z -z
t(5)
!Hello Allo Hallo !
--> typeof(t)
ans =
mytype
Nothing has changed between Scilab 5 and Scilab 6 about that.
HTH
Samuel
Le 18/02/2017 à 14:02, Dirk Reusch a écrit :
> 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
> dev at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/dev/attachments/20170221/f5ebb099/attachment.htm>
More information about the dev
mailing list