[Scilab-users] On parameters passing by name in scilab functions

Adelson Oliveira adelson.oliveira at gmail.com
Mon Feb 27 23:05:34 CET 2017


BTW,

Scilab has always had problems to provide interfaces to languages that
accept optional parameters (but not only because of it) like modern FORTRAN.

2017-02-27 18:57 GMT-03:00 Adelson Oliveira <adelson.oliveira at gmail.com>:

> Well, now scilab 6.0 ignores named parameters at fft calls. One can check
> it with
>
> fft(eye(4,4),-1,dims=4,incr=1)-fft(eye(4,4),-1)
>
> the result is 4X4 matrix with zeros. This is different from (without
> names):
>
> fft(eye(4,4),-1,4,1)-fft(eye(4,4),-1).
>
> Then, I guess it is to say optional parameters are no longer "fully"
> optional, they must be provided in their order ...
>
> But anyway, it seems that my personal "macros" or functions still work
> with named optional parameters (opt1, opt2, ....) treated as,
>
>    if exists('opt1','local') == 0 then
>       opt1 = default_opt1.;
>    end
>
>
> 2017-02-27 16:18 GMT-03:00 Samuel Gougeon <sgougeon at free.fr>:
>
>> Le 27/02/2017 à 19:49, Tim Wescott a écrit :
>>
>>> You misread my comments.  Tim _likes_ named parameters.  If Tim were on
>>> the C++ standards committee (which is as likely as pigs flying, BTW)
>>> Tim would agitate that named parameters be adopted into that language.
>>>   Scilab, Verilog, and (I think) VHDL have it, and particularly in a
>>> language that allows for optional parameters, I feel that when you have
>>> to have function calls with more than a few parameters it vastly aids
>>> code readability.
>>>
>> Sorry for my misinterpretation.
>> I agree that it is easier to use named parameters rather than to have to
>> count and feed many "empty" or default positions to reach useful trailing
>> ones. But when a parameter has been badly named when designing the function
>> (*), then it is done and over. We must bear it all the time. And this is
>> not nice at all.
>> Same thing when you want to add a parameter that has a meaning close to
>> another already existing one. Then keeping things (names) clear may become
>> hard. Moreover, things get more complicated when using varargin (that
>> ignores names).
>>
>> (*) this is often the case. Scilab misses a standards committee, also to
>> well name things.
>>
>>
>> _______________________________________________
>> users mailing list
>> users at lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170227/cfc0b40c/attachment.htm>


More information about the users mailing list