<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>IMO, it's not about named parameters; <br>
furthermore, it is not about readability, but this IMO<br>
is a maintenance issue. <br>
</p>
<p>Think about a procedure that has two parameters and a lot of
callers<br>
and you want to add a third one. <br>
</p>
<p>it would be nice if you could specify a default value for the new<br>
third parameter and don't have to change all the callers that use<br>
only two. <br>
</p>
<p>So IMO a sensible extension to the Pascal syntax could be: <br>
</p>
<p>if there is a initialization on the procedure declaration, the
parameter <br>
is optional. <br>
</p>
<p>Example: <br>
</p>
<p>procecure P (x : integer; y : boolean; c: char := ' '); <br>
</p>
<p>the first two parameters are mandatory, the third is optional. <br>
Calls to P with 2 and 3 parameters are both valid. <br>
</p>
<p>Another extension would be: <br>
</p>
<p>specify the formal parameter's name on call, that is: <br>
</p>
<p>P (y := true, c := '*', x := 25); <br>
</p>
<p>which allows for a different sequence of arguments on the
procedure call<br>
</p>
<p>but this is a different topic and should be discussed seperate
from the <br>
default issue. <br>
</p>
<p>I guess, that all this will be limited to byvalue parameters ...
not for <br>
var parameters ... <br>
</p>
<p>Kind regards</p>
<p>Bernd</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 27.05.2017 um 08:17 schrieb Mr Bee
via fpc-pascal:<br>
</div>
<blockquote type="cite"
cite="mid:CAPfiFWuVFk6G4d2x7ajU633oh+Rnu9hRMCzy5aVEL_aAw3Jhqw@mail.gmail.com">
<div dir="ltr">Hi,
<div><br>
</div>
<div>As Pascal mostly well known as a safe, easy to read, and
elegant language, don't you think Pascal needs named
parameter? I mean for ALL kind of parameters, not just for
Variants. When you have a function with many parameters having
default values, you know that named parameter is desirable.
For example:</div>
<div><br>
</div>
<div>function f(p1: string = ''; p2: integer = 0; p3: boolean =
false);</div>
<div><br>
</div>
<div>But you only need to supply the third parameter, you still
must supply the first and second ones with appropriate default
values, like this:</div>
<div><br>
</div>
<div>f('', 0, true);</div>
<div><br>
</div>
<div>while with named parameter, you can do this:</div>
<div><br>
</div>
<div>f(p3 := true);</div>
<div><br>
</div>
<div>I believe it would raise Pascal's code readability. I know
it has been discussed before. I know somehow the parser had
been able to read such syntax. So, why don't we have the
option to enable it for people who want it? Kinda a syntax
switch mode.</div>
<div><br>
</div>
<div>What do you think? :)</div>
<div>
<div><br>
</div>
-- <br>
<div class="gmail_signature" data-smartmail="gmail_signature">
<div dir="ltr"><br>
<div>
<div>Regards,</div>
<div><br>
</div>
<div><br>
</div>
<div>–Mr Bee</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
</body>
</html>