Re: [fpc-pascal] named parameter

2017-05-29 Thread Sven Barth via fpc-pascal
Am 29.05.2017 10:26 schrieb "Ryan Joseph" : > > > > On May 29, 2017, at 1:01 PM, Sven Barth via fpc-pascal < fpc-pascal@lists.freepascal.org> wrote: > > > > If anything like this would be implemented, then the already existing syntax (for variant dispatch calls) would

Re: [fpc-pascal] named parameter

2017-05-29 Thread Mark Morgan Lloyd
On 29/05/17 05:15, Ryan Joseph wrote: On May 28, 2017, at 5:22 PM, Mark Morgan Lloyd 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

Re: [fpc-pascal] named parameter

2017-05-29 Thread Ryan Joseph
> On May 29, 2017, at 1:01 PM, Sven Barth via fpc-pascal > wrote: > > If anything like this would be implemented, then the already existing syntax > (for variant dispatch calls) would be used which uses ":=". > > What are variant dispatch calls? Maybe

Re: [fpc-pascal] named parameter

2017-05-29 Thread Sven Barth via fpc-pascal
Am 29.05.2017 07:13 schrieb "Ryan Joseph" : > > > > On May 28, 2017, at 5:22 PM, Mark Morgan Lloyd < markmll.fpc-pas...@telemetry.co.uk> wrote: > > > >> IMO though it does improve readability in long functions with lots of > >> parameters, like windows api style

Re: [fpc-pascal] named parameter

2017-05-28 Thread Ryan Joseph
> On May 28, 2017, at 5:22 PM, Mark Morgan Lloyd > 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 >>

Re: [fpc-pascal] named parameter

2017-05-28 Thread Marco van de Voort
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

Re: [fpc-pascal] named parameter

2017-05-28 Thread Mark Morgan Lloyd
On 27/05/17 20:30, nore...@z505.com 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

Re: [fpc-pascal] named parameter

2017-05-28 Thread Ewald
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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Graeme Geldenhuys
On 2017-05-27 21:14, nore...@z505.com 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread noreply
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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Sven Barth via fpc-pascal
2017-05-27 16:12 GMT+02:00 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 : >>> >>> >>> >>> On Sat, 27 May 2017, Mr Bee via fpc-pascal wrote: >>> Hi,

Re: [fpc-pascal] named parameter

2017-05-27 Thread 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 : 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Sven Barth via fpc-pascal
2017-05-27 9:54 GMT+02:00 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 >>

Re: [fpc-pascal] named parameter

2017-05-27 Thread Ryan Joseph
> On May 27, 2017, at 5:29 PM, Mark Morgan Lloyd > 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Mark Morgan Lloyd
On 27/05/17 10:20, Ryan Joseph wrote: On May 27, 2017, at 5:13 PM, Mark Morgan Lloyd 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Ryan Joseph
> On May 27, 2017, at 5:13 PM, Mark Morgan Lloyd > 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Mark Morgan Lloyd
On 27/05/17 09:40, Ryan Joseph wrote: On May 27, 2017, at 4:27 PM, Graeme Geldenhuys 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Martin Schreiber
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;

Re: [fpc-pascal] named parameter

2017-05-27 Thread Bernd Oppolzer
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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Ryan Joseph
> On May 27, 2017, at 4:27 PM, Graeme Geldenhuys > 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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Graeme Geldenhuys
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

Re: [fpc-pascal] named parameter

2017-05-27 Thread Mark Morgan Lloyd
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

Re: [fpc-pascal] named parameter

2017-05-27 Thread 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

[fpc-pascal] named parameter

2017-05-27 Thread 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.