named parameter

classic Classic list List threaded Threaded
25 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

named parameter

Free Pascal - General mailing list
Hi,

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:

function f(p1: string = ''; p2: integer = 0; p3: boolean = false);

But you only need to supply the third parameter, you still must supply the first and second ones with appropriate default values, like this:

f('', 0, true);

while with named parameter, you can do this:

f(p3 := true);

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.

What do you think? :)

--

Regards,


–Mr Bee

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Michael Van Canneyt


On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote:

> Hi,
>
> 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:
>
> function f(p1: string = ''; p2: integer = 0; p3: boolean = false);
>
> But you only need to supply the third parameter, you still must supply the
> first and second ones with appropriate default values, like this:
>
> f('', 0, true);
>
> while with named parameter, you can do this:
>
> f(p3 := true);
>
> 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.
>
> What do you think? :)


Opinions on what constitutes readable code clearly differ :)

But as far as I know, the parser is not able to read this syntax ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Mark Morgan Lloyd-5
On 27/05/17 08:00, Michael Van Canneyt wrote:

> On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote:
>> Hi,>> 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:>> function f(p1: string =
>> ''; p2: integer = 0; p3: boolean = false);>> But you only need to
>> supply the third parameter, you still must supply the> first and
>> second ones with appropriate default values, like this:>> f('', 0,
>> true);>> while with named parameter, you can do this:>> f(p3 :=
>> true);>> 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.>> What do you think? :)
>
> Opinions on what constitutes readable code clearly differ :)
> But as far as I know, the parser is not able to read this syntax ?

It would probably be possible to do it by using a record with nullable
fields as the parameter.

Otherwise if you want that sort of thing use Smalltalk :-)

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Bernd Oppolzer
In reply to this post by Free Pascal - General mailing list

IMO, it's not about named parameters;
furthermore, it is not about readability, but this IMO
is a maintenance issue.

Think about a procedure that has two parameters and a lot of callers
and you want to add a third one.

it would be nice if you could specify a default value for the new
third parameter and don't have to change all the callers that use
only two.

So IMO a sensible extension to the Pascal syntax could be:

if there is a initialization on the procedure declaration, the parameter
is optional.

Example:

procecure P (x : integer; y : boolean; c: char := ' ');

the first two parameters are mandatory, the third is optional.
Calls to P with 2 and 3 parameters are both valid.

Another extension would be:

specify the formal parameter's name on call, that is:

P (y := true, c := '*', x := 25);

which allows for a different sequence of arguments on the procedure call

but this is a different topic and should be discussed seperate from the
default issue.

I guess, that all this will be limited to byvalue parameters ... not for
var parameters ...

Kind regards

Bernd


Am 27.05.2017 um 08:17 schrieb Mr Bee via fpc-pascal:
Hi,

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:

function f(p1: string = ''; p2: integer = 0; p3: boolean = false);

But you only need to supply the third parameter, you still must supply the first and second ones with appropriate default values, like this:

f('', 0, true);

while with named parameter, you can do this:

f(p3 := true);

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.

What do you think? :)

--

Regards,


–Mr Bee


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Graeme Geldenhuys-6
In reply to this post by Mark Morgan Lloyd-5
On 2017-05-27 09:47, Mark Morgan Lloyd wrote:
> It would probably be possible to do it by using a record with nullable
> fields as the parameter.

Yeah, that was going to be my suggestion too. I've done this many times
when many parameters are optional. Use a record as parameter type. The
other benefit of this is that it is future and backwards compatible. You
can add or change parameters without breaking the method signature.

Regards,
   Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Ryan Joseph

> On May 27, 2017, at 4:27 PM, Graeme Geldenhuys <[hidden email]> wrote:
>
> Yeah, that was going to be my suggestion too. I've done this many times when many parameters are optional. Use a record as parameter type. The other benefit of this is that it is future and backwards compatible. You can add or change parameters without breaking the method signature.

can you show an example of this? Just curious.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Martin Schreiber-2
On Saturday 27 May 2017 11:30:38 Ryan Joseph wrote:
>
> can you show an example of this? Just curious.
>
In MSEgui most of the public widget methods an method properties use this
approach.
"
type
 keyeventinfoty = record
  eventkind: eventkindty;
  key,keynomod: keyty;
  chars: msestring;
  shiftstate: shiftstatesty;
  eventstate: eventstatesty;
  timestamp: longword; //usec
 end;
[...]
 twidget = class(tactcomponent,iscrollframe,iface,iassistiveclient)
[...]
   procedure dokeydown(var info: keyeventinfoty); virtual;
"
"
type
 tactionwidget = class(twidget)
[...]
   property onkeydown: keyeventty read fonkeydown write fonkeydown;

"
https://gitlab.com/mseide-msegui/mseide-msegui/blob/master/lib/common/kernel/msegui.pas
https://gitlab.com/mseide-msegui/mseide-msegui/blob/master/lib/common/widgets/msewidgets.pas

Martin
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Mark Morgan Lloyd-5
In reply to this post by Ryan Joseph
On 27/05/17 09:40, Ryan Joseph wrote:
>> On May 27, 2017, at 4:27 PM, Graeme Geldenhuys <[hidden email]> wrote:> > Yeah, that was going to be my suggestion too. I've done this many times when many parameters are optional. Use a record as parameter type. The other benefit of this is that it is future and backwards compatible. You can add or change parameters without breaking the method signature.
> can you show an example of this? Just curious.

IIRC the problem is that while it's possible to initialise a record
constant by named fields processed in arbitrary order, the compiler at
present doesn't allow it to be done inline:

someFunction(TPoint(X:0.0; Y:0.0));

Pascal purists would probably object to that style, since what it's
effectively doing is passing the parameters as an explicit list.

Somebody please correct me it I'm wrong.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Ryan Joseph

> On May 27, 2017, at 5:13 PM, Mark Morgan Lloyd <[hidden email]> wrote:
>
> someFunction(TPoint(X:0.0; Y:0.0));
>
> Pascal purists would probably object to that style, since what it's effectively doing is passing the parameters as an explicit list.

I mentioned this form of “default constructor" as a sorely missing feature in FPC a couple weeks ago. Making redundant constructors for records constantly is pretty silly. If I could figure out the compiler code I would add this myself since it’s probably one of the easier things to implement.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Mark Morgan Lloyd-5
On 27/05/17 10:20, Ryan Joseph wrote:
>> On May 27, 2017, at 5:13 PM, Mark Morgan Lloyd <[hidden email]> wrote:> > someFunction(TPoint(X:0.0; Y:0.0));> > Pascal purists would probably object to that style, since what it's effectively doing is passing the parameters as an explicit list.
> I mentioned this form of “default constructor" as a sorely missing feature in FPC a couple weeks ago. Making redundant constructors for records constantly is pretty silly. If I could figure out the compiler code I would add this myself since it’s probably one of the easier things to implement.

End of last month actually, I checked :-)

I was on the periphery of that discussion, since I thought I needed
something similar (but turned out not to). But you might have noticed
some of the APLisms that I horrify Sven with on occasion...

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Ryan Joseph

> On May 27, 2017, at 5:29 PM, Mark Morgan Lloyd <[hidden email]> wrote:
>
> I was on the periphery of that discussion, since I thought I needed something similar (but turned out not to). But you might have noticed some of the APLisms that I horrify Sven with on occasion...

I remember he liked my idea to use TPoint(x: 1; y: 2); using the record name as the identifier. I swear I’d add this if I knew how. :)

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Free Pascal - General mailing list
In reply to this post by Michael Van Canneyt
2017-05-27 9:54 GMT+02:00 Michael Van Canneyt <[hidden email]>:

>
>
> On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote:
>
>> Hi,
>>
>> 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:
>>
>> function f(p1: string = ''; p2: integer = 0; p3: boolean = false);
>>
>> But you only need to supply the third parameter, you still must supply the
>> first and second ones with appropriate default values, like this:
>>
>> f('', 0, true);
>>
>> while with named parameter, you can do this:
>>
>> f(p3 := true);
>>
>> 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.
>>
>> What do you think? :)
>
>
>
> Opinions on what constitutes readable code clearly differ :)
>
> But as far as I know, the parser is not able to read this syntax ?

The parser supports it for dispatch calls on variants (both methods
and properties). You even wrote that in your own article about Word
automation: https://www.freepascal.org/~michael/articles/word/word.pdf
;)

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Michael Van Canneyt


On Sat, 27 May 2017, Sven Barth via fpc-pascal wrote:

> 2017-05-27 9:54 GMT+02:00 Michael Van Canneyt <[hidden email]>:
>>
>>
>> On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote:
>>
>>> Hi,
>>>
>>> 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:
>>>
>>> function f(p1: string = ''; p2: integer = 0; p3: boolean = false);
>>>
>>> But you only need to supply the third parameter, you still must supply the
>>> first and second ones with appropriate default values, like this:
>>>
>>> f('', 0, true);
>>>
>>> while with named parameter, you can do this:
>>>
>>> f(p3 := true);
>>>
>>> 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.
>>>
>>> What do you think? :)
>>
>>
>>
>> Opinions on what constitutes readable code clearly differ :)
>>
>> But as far as I know, the parser is not able to read this syntax ?
>
> The parser supports it for dispatch calls on variants (both methods
> and properties). You even wrote that in your own article about Word
> automation: https://www.freepascal.org/~michael/articles/word/word.pdf
> ;)

Yes, in Delphi. But I didn't know FPC also supports it ?

Michael.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Free Pascal - General mailing list
2017-05-27 16:12 GMT+02:00 Michael Van Canneyt <[hidden email]>:

>
>
> On Sat, 27 May 2017, Sven Barth via fpc-pascal wrote:
>
>> 2017-05-27 9:54 GMT+02:00 Michael Van Canneyt <[hidden email]>:
>>>
>>>
>>>
>>> On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote:
>>>
>>>> Hi,
>>>>
>>>> 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:
>>>>
>>>> function f(p1: string = ''; p2: integer = 0; p3: boolean = false);
>>>>
>>>> But you only need to supply the third parameter, you still must supply
>>>> the
>>>> first and second ones with appropriate default values, like this:
>>>>
>>>> f('', 0, true);
>>>>
>>>> while with named parameter, you can do this:
>>>>
>>>> f(p3 := true);
>>>>
>>>> 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.
>>>>
>>>> What do you think? :)
>>>
>>>
>>>
>>>
>>> Opinions on what constitutes readable code clearly differ :)
>>>
>>> But as far as I know, the parser is not able to read this syntax ?
>>
>>
>> The parser supports it for dispatch calls on variants (both methods
>> and properties). You even wrote that in your own article about Word
>> automation: https://www.freepascal.org/~michael/articles/word/word.pdf
>> ;)
>
>
> Yes, in Delphi. But I didn't know FPC also supports it ?

Yes, it does. I didn't find a testcase for it right away, but the
compiler definitely contains code for this.

Regards,
Sven
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

noreply
In reply to this post by Free Pascal - General mailing list
On 2017-05-27 01:17, Mr Bee via fpc-pascal wrote:

> Hi,
>
> 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:
>
> function f(p1: string = ''; p2: integer = 0; p3: boolean = false);
>
> But you only need to supply the third parameter, you still must supply
> the first and second ones with appropriate default values, like this:
>
> f('', 0, true);
>
> while with named parameter, you can do this:
>
> f(p3 := true);
> ;

You can do something similar already with source comments

SomeProc(true {p3})

or

SomeProc({p3} true);

But obviously the compiler doesn't check it.

Problem is it increases the verbosity of the code, and how would the
compiler determine when to check these and when not to... If you check
this all the time it makes the language much more verbose and tedious
for small functions like inttostr that you use all the time.

IMO though it does improve readability in long functions with lots of
parameters, like windows api style procedures that have 5 or more
parameters and you can't figure out which param is which
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Graeme Geldenhuys-6
On 2017-05-27 21:14, [hidden email] wrote:
>> f(p3 := true);
>> ;
> You can do something similar already with source comments
>
> SomeProc(true {p3})

That will not work. p3 in his example is the 3rd parameter. You are only
passing one parameter, so that will then become p1's value. And if the
types don't match, you'll get a compiler error.

Optional parameters can only be at the end of the parameter list, and
always from left-to-right.

Regards,
   Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Ewald-2
In reply to this post by Bernd Oppolzer
On 27/05/17 11:26, Bernd Oppolzer wrote:
> it would be nice if you could specify a default value for the new
> third parameter and don't have to change all the callers that use
> only two.
>
[snip]
> procecure P (x : integer; y : boolean; c: char := ' ');
>
> the first two parameters are mandatory, the third is optional.
> Calls to P with 2 and 3 parameters are both valid.

You realize you can already do this, right?

See https://www.freepascal.org/docs-html/ref/refsu64.html#x176-19800014.4.1


--
Ewald
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Mark Morgan Lloyd-5
In reply to this post by noreply
On 27/05/17 20:30, [hidden email] wrote:

> IMO though it does improve readability in long functions with lots of
> parameters, like windows api style procedures that have 5 or more
> parameters and you can't figure out which param is
> which

I had an interesting case a couple of years ago where a procedure called
itself recursively, but with a couple of the parameters shifted in
relative position. Messing that up when I added an extra parameter
caused a difficult-to find bug, so I think that some sort of
identify-by-name arrangment (I'm not saying pass-by-name because of its
historical meaning) would be useful.

procedure SendMechCodeToLineASCII(mc: word; bcd, apl: boolean; crlf:
boolean= false;
                         lf: boolean= false; echo: boolean= false;
loopback: boolean= false);

..

(* CR expansion, local echo etc. Note recursive echo of LF if CR is
expanded,   *)
(* this is to keep the VM/CMS "Sixpack" happy since otherwise the first
line of *)
(* output always tries to overwrite the command that instigated it (but
with    *)
(* bits of the command showing through non-destructive spaces).
        *)
(*
        *)
(* Note intentional shift of parameter positions in the recursive call
below.   *)

     if (mc = Op_CarrierReturn) and crlf then
       SendMechCodeToLineASCII(Op_Index, bcd, apl, {crlf :=} loopback,
{lf :=} false,
                                         {echo := } true, {loopback :=}
false);
     if echo then
       PseudoEventQueue.Enqueue($80000000 + canonical(mc))
   end
end { SendMechCodeToLineASCII } ;

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Marco van de Voort
In reply to this post by Bernd Oppolzer
In our previous episode, Bernd Oppolzer said:

> IMO, it's not about named parameters;
> furthermore, it is not about readability, but this IMO
> is a maintenance issue.
>
> Think about a procedure that has two parameters and a lot of callers
> and you want to add a third one.
>
> it would be nice if you could specify a default value for the new
> third parameter and don't have to change all the callers that use
> only two.

Yes, that is why Visual Basic had it, but I thought the whole concept was
nowadays considered old fashioned and baroque.
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: named parameter

Ryan Joseph
In reply to this post by Mark Morgan Lloyd-5

> On May 28, 2017, at 5:22 PM, Mark Morgan Lloyd <[hidden email]> wrote:
>
>> IMO though it does improve readability in long functions with lots of
>> parameters, like windows api style procedures that have 5 or more
>> parameters and you can't figure out which param is
>> which
>

You mean like this?

function Foo (theString: string; options: set of TFoo): boolean;
begin
end;

Foo(theString: 'foo', options: []);

Objective-C has this mandatory and it made for stupidly long method names that just looked terrible but it was optional Pascal makes it look nicer. The declaration syntax is already the same as the label for the calling syntax so that seems like a nice fit.

Regards,
        Ryan Joseph

_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
12
Loading...