<p>Am 01.04.2013 20:29 schrieb "Frank Church" <<a href="mailto:vfclists@gmail.com">vfclists@gmail.com</a>>:<br>
><br>
> Does FreePascal support named parameters?<br>
><br>
> Are they in the pipeline?</p>
<p>Yes and no. As Anthony wrote such a construct is available for Variants and thus is supported by the parser. Normally this is disabled though. In case of the parser you should look out for "named_args_allowed" (or similar). What I don't know though is how the names parameters are handled after that...</p>
<p>><br>
> Func(aNumber: integer; aString: string);<br>
><br>
> I want to be able to write Func(aNumber := 4, aString := 'anystring');<br>
> If I type Func(aString := 'anystring',4) the compiler should generate<br>
> an error as the order of parameters has been changed.</p>
<p>As said: this syntax is already supported (though I don't know to what extent your example would work).</p>
<p>> Coming to think of it will be just as easy to wrap the parameter names<br>
> in comments i.e Func({aNumber}4, {aString} 'anystring'), much simpler<br>
> and almost is good. Is such a style acceptable? I don't mind using it<br>
> in my own code.</p>
<p>And here we can see that you haven't worked much with the internals of the compiler yet (Note: no offence intended). Using comments for anything besides comments (and compiler directives) is extremely hard, because they are entirely handled by the scanner. The parser will not know that a comment existed there.</p>
<p>Regards,<br>
Sven</p>