[Scilab-users] Arguments of functions in Scilab

Pierre Vuillemin contact at pierre-vuillemin.fr
Sat Mar 4 12:27:18 CET 2017


Hi all,

I'm a bit confused by functions in Scilab and specifically the way they 
handle their arguments. For instance, in the following code

deff('g(x)','disp(x)');
g; // produces an error saying x is not defined
x = 1;
g; // call the function g and displays x...

leads to two questions,

  * the function g is called each time, shouldn't it be only displayed?
  * the second call 'works' and display x, even if the argument of the
    function has not been provided.  I've read the page concerning
    scoping of variables
    <https://wiki.scilab.org/howto/global%20and%20local%20variables> in
    Scilab, but shouldn't it says that the function was expecting 1
    argument?

This feels a bit unsafe to me, I'm wondering what is the reason behind 
this choice?

Best regards,

Pierre

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170304/fc4f74b3/attachment.htm>


More information about the users mailing list