[fpc-devel] Does FreePascal support named parameters?

Frank Church vfclists at gmail.com
Mon Apr 1 20:29:15 CEST 2013


Does FreePascal support named parameters?

Are they in the pipeline?

I am not interested in the whole nine yards in case it will be
difficult to implement. I am thinking of something that will make it
easier to read, but not change the code generation, ie the order of
the parameters should remain the same, so that the compiler can
generate the same code.

consider a function such as.

Func(aNumber: integer; aString: string);

I want to be able to write Func(aNumber := 4, aString := 'anystring');
If I type Func(aString := 'anystring',4) the compiler should generate
an error as the order of parameters has been changed.

Coming to think of it will be just as easy to wrap the parameter names
in comments i.e Func({aNumber}4, {aString} 'anystring'), much simpler
and almost is good. Is such a style acceptable? I don't mind using it
in my own code.

-- 
Frank Church

=======================
http://devblog.brahmancreations.com



More information about the fpc-devel mailing list