<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Hello Adelson,<br>
<br>
Le 27/02/2017 à 15:46, Adelson Oliveira a écrit :<br>
</div>
<blockquote
cite="mid:CAOsmt4U4MpEEy8ej==ubyDFTA9sJn+aqfWudJYGtJ-AyH7njuQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>Hi,<br>
<br>
</div>
Let's take fft as an example.<br>
<br>
</div>
<div>In scilab 5 one could call fft specifying parameters like
dim and incr by name,<br>
<br>
</div>
<div>fft(A,-1,dim=100,incr=1)<br>
</div>
</div>
</blockquote>
Here names are simply ignored. There would be a true call by names
if the order would not matter, while it does:<br>
<tt>-->Fp2 = fft(A,-1,incr=1,dim=100);</tt><tt><br>
</tt><tt> !--error 999 </tt><tt><br>
</tt><tt>fftw: Wrong values for input argument #3: Elements must be
greater than 1.</tt><tt><br>
</tt><br>
I guess that this is because fft() is a built-in, not a "macro".<br>
But even for functions written in Scilab language (aka macros),
passing named parameters is strongly discouraged:<br>
<ul>
<li>this sets a formal link between the calling level and the
inner called one. Then, any change of the parameters names in
the function definition breaks such calls.</li>
<li>the definition of most (say 99%) scilab functions test input
parameters against their position rather than their name. It is
not robust, but so it is. So (provided that fft() would be a
macro) when calling fft(1,-1,incr=1), incr is detected at the
third position while in the definition it is listed in the 4th
one. Really efficient to get a mess ;)<br>
<pre style="font-family:Monospaced;font-style:normal;font-size:13.0;"><span style="color:rgb(176,24,19);">function</span> <span style="color:rgb(0,0,0);text-decoration:underline;">test</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(131,67,16);font-weight:bold;">a</span><span style="color:rgb(0,0,0);">, </span><span style="color:rgb(131,67,16);font-weight:bold;">b</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(50,185,185);">mprintf</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">RHS=%d, exists(a)=%d exists(b)=%d\n</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(50,185,185);">argn</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">2</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(50,185,185);">exists</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">a</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">l</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(50,185,185);">exists</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">b</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(188,143,143);">l</span><span style="color:rgb(188,143,143);">"</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(74,85,219);">)</span>
<span style="color:rgb(176,24,19);">endfunction
</span></pre>
<pre style="font-family:Monospaced;font-style:normal;font-size:13.0;"><tt>-->test(b=1)</tt><tt>
</tt><tt>RHS=1, exists(a)=0 exists(b)=1</tt><tt>
</tt><tt> </tt><tt>
</tt><tt>-->test(b=1,a=2)</tt><tt>
</tt><tt>RHS=2, exists(a)=1 exists(b)=1</tt>
<span style="color:rgb(176,24,19);"></span></pre>
<span style="color:rgb(176,24,19);"></span></li>
</ul>
<p>So, Tim is right. Calls with named parameters make the code
fragile, or make somewhat harder to code the analysis of input
arguments in a robust way. This coding way still increases
functions overheads, that make them slower.<br>
</p>
Samuel<br>
<br>
</body>
</html>