[Scilab-Dev] overloading problem ... next
ycollet at freesurf.fr
ycollet at freesurf.fr
Wed Apr 1 14:51:53 CEST 2009
Sorry, it's in the documentation. But in the overload documentation, the
limitation is set to the first 9 characters. It's 8.
It's very annoying for "fake" object oriented programming ...
YC
On Wed, 01 Apr 2009 14:40:06 +0200, <ycollet at freesurf.fr> wrote:
> A sample test for the overloading limitation for 8 char:
>
> myvar1 = tlist(['scilabmyvar1','x','y'],2.0,3.0);
> myvar2 = tlist(['scilabmyvar2','x','y','z'],2.0,3.0, 4.0);
> myvar3 = tlist(['scilabm','x','y','z'],2.0,3.0,4.0);
>
> function y = %scilabmyvar1_sin(myvar)
> printf('sin with a scilabmyvar1\n');
> y = sin(2*%pi*sqrt(myvar('x')^2 + myvar('y')^2));
> endfunction
>
> function y = %scilabmyvar2_sin(myvar)
> printf('sin with a scilabmyvar2\n');
> y = sin(2*%pi*sqrt(myvar('x')^2 + myvar('y')^2 + myvar('z')^2));
> endfunction
>
> function y = %scilabm_sin(myvar)
> printf('sin with a scilabm\n');
> y = sin(2*%pi*sqrt(myvar('x')^2 + myvar('y')^2 + myvar('z')^2));
> endfunction
>
> printf('sin + scilabmyvar1 = %f\n',sin(myvar1)); // Line 1
> printf('sin + scilabmyvar2 = %f\n',sin(myvar2)); // Line 2
> printf('sin + scilabm = %f\n',sin(myvar3)); // Line 3
>
> ------------- end of test_overload.sce
>
> If you comment Line 1 and Line 2:
>
> -->exec test_overload.sce;
> sin with a scilabm
> sin + scilabm = 0.660535
>
> Now, if I uncomment everything:
>
> -->exec test_overload.sce;
> printf('sin + scilabmyvar1 = %f\n',sin(myvar1));
> !--error 246
> Fonction non définie pour le type d'argument donné.
>
> vérifier les arguments ou définir la fonction %scilabmy_sin pour la
> surcharge.
>
> at line 20 of exec file called by :
> exec test_overload.sce;
>
>
> Scilab sees only the type "scilabmy" (8 chars) and not the "scilabmyvar1"
>
> YC
>
More information about the dev
mailing list