[fpc-devel] Idea/question about a language (syntax) extension

Flávio Etrusco flavio.etrusco at gmail.com
Tue Dec 22 06:47:53 CET 2009


On Tue, Dec 22, 2009 at 2:27 AM, Alexander Klenin <klenin at gmail.com> wrote:
> On Tue, Dec 22, 2009 at 14:42, Paul Ishenin <ip at kmiac.ru> wrote:
>> 22.12.2009 11:30, Flávio Etrusco wrote:
>>>
>>> Hi all,
>>> I want to propose a syntax extension for the compiler to check
>>> parameters' name on function/procure calls. Would such a patch be
>>> accepted? Does anybody have a suggestion for the  syntax? (i guess
>>> something along the line of a compiler directive to go together with
>>> the parameter value to avoid syntax incompatibility...)
>>
>> You mean something like Basic has:
>>
>> CallSomething(Arg1=10, Arg2='Test') ?
>
> I'd say rather something like
>
> CallSomething(Arg1:=10, Arg2:='Test')
>
> which is already sort-of-supported by Delphi for automation classes:
>
> http://stackoverflow.com/questions/885942/named-optional-parameters-in-delphi
>
> Extending such support to native procedures and functions
> would be, in my opinion, a good idea.
>
> --
> Alexander S. Klenin

Hmm. Does it allow to pass parameter out of the declared order?
I just wanted the check for the correct parameter, but I'm sure people
will then want the additional feature... :-/ Not to mention that with
this syntax some people may think FPC is allowing C-like
assignment-with-result :-o
(And maybe we'd want something to make it clear we're talking about
destination parameters, not some clashing local variable/paramter...)

-Flávio



More information about the fpc-devel mailing list