Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Sven Barth via fpc-pascal
Ryan Joseph schrieb am Mo., 7. Okt. 2019, 00:16: > > > > >>> 3. > >>> timpfuncspez2.pp > >>> DoThis > >>> DoThis > >>> Delphi gives an error "Ambiguous call to DoThis". FPC silently > >>> selects the one with only one param. IMO this is dangerous, it > >>> should give an error. > > > > generic

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Ryan Joseph
> On Oct 6, 2019, at 5:42 PM, Mattias Gaertner via fpc-pascal > wrote: > > I meant: > > generic procedure DoThis(param1: T; param2: word = 100); > begin > end; That works then. Added a test: {$mode objfpc} {$modeswitch implicitfunctionspecialization} program timpfuncspez15; generic

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Ryan Joseph
> On Oct 6, 2019, at 5:40 PM, Mattias Gaertner via fpc-pascal > wrote: > >> Which test? Please post a sample. > > generic procedure DoThis(a:T; b:T); > begin end; > > begin > DoThis(1,200); // 1 sets T to shortint, so the 200 gives a warning > end; > What is the preferred behavior? I’m

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Mattias Gaertner via fpc-pascal
On Sun, 6 Oct 2019 17:10:54 -0400 Ryan Joseph wrote: > > On Oct 6, 2019, at 5:03 PM, Ryan Joseph > > wrote: > >> On Oct 6, 2019, at 2:06 PM, Mattias Gaertner via fpc-pascal > >> wrote: > >> > >> 1. > >> FPC allows default params, Delphi does not. Nice. > >> I see no tests for this though, so

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Mattias Gaertner via fpc-pascal
On Sun, 6 Oct 2019 17:03:10 -0400 Ryan Joseph wrote: >[...] > > 2. > > DoThis(1,200) gives range check warning instead of error. A warning > > means there are some rare cases, where this code is correct. Is > > this a todo or do you see a useful case? > > Which test? Please post a sample.

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Ryan Joseph
> On Oct 6, 2019, at 5:03 PM, Ryan Joseph wrote: > >> On Oct 6, 2019, at 2:06 PM, Mattias Gaertner via fpc-pascal >> wrote: >> >> 1. >> FPC allows default params, Delphi does not. Nice. >> I see no tests for this though, so maybe this was not on purpose? > > Probably an oversight if you

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Ryan Joseph
Thanks for testing. I don’t have access to Delphi so I need help to make it Delphi compatible. > On Oct 6, 2019, at 2:06 PM, Mattias Gaertner via fpc-pascal > wrote: > > 1. > FPC allows default params, Delphi does not. Nice. > I see no tests for this though, so maybe this was not on purpose?

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Mattias Gaertner via fpc-pascal
On Sun, 6 Oct 2019 12:23:57 -0400 Ryan Joseph wrote: > > On Oct 6, 2019, at 12:18 PM, Mattias Gaertner via fpc-pascal > > wrote: > > > > Ryan, is patch_3_25.diff the latest patch? > > > > I get a lot of merge conflicts. > > What fpc revision is needed for this? > > > > And what is the git

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Ryan Joseph
> On Oct 6, 2019, at 12:18 PM, Mattias Gaertner via fpc-pascal > wrote: > > Ryan, is patch_3_25.diff the latest patch? > > I get a lot of merge conflicts. > What fpc revision is needed for this? > > And what is the git repo > https://github.com/genericptr/freepascal/tree/generic_implicit >

Re: [fpc-pascal] generic proc inference

2019-10-06 Thread Mattias Gaertner via fpc-pascal
On Fri, 4 Oct 2019 11:10:22 -0400 Ryan Joseph wrote: > > On Oct 3, 2019, at 6:07 PM, Sven Barth via fpc-pascal > > wrote: > > > > A patch for it by Ryan Joseph exists > > ( https://bugs.freepascal.org/view.php?id=35261 ), but I've not yet > > found the time to review it. > > I’m eager to use