[Scilab-users] Emulate Object Oriented Programming

Serge Steer Serge.Steer at inria.fr
Wed Nov 28 09:23:08 CET 2012


Le 27/11/2012 10:08, michael.baudin at contrib.scilab.org a écrit :
> Hi,
>
> Thank you Serge for this interesting script.
> Defining a tlist with unnamed fields is indeed an idea which
> is quite unusual !
>
> You will find in attachment a modified version, merging your proposal 
> and my
> previous attempt.
>
> On the user's side, the "object" can now produce messages such as:
>
> -->bob.weight=-5
>  !--error 10000
> Expect nonnegative weight.
> at line      18 of function %s_i_THUMAN called by :
> bob.weight=-5
>
> which is excellent.
>
> On the developper's side, the "set" function (which is
> called insertion in the overloading vocabulary), is now
> much less clear, because fields are now identified with
> their index (i.e. 1, 2, 3,...) instead of their name
> (i.e. "name", "weight", ...).
>
You can also use tlist with names, to index the entry, just use "hidden" 
field names instead of the user one
for example tlist(["human","%name","%surname",...)
so the developper uses the %name field  and the user the name one.
Serge




More information about the users mailing list