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 > <fpc-pascal@lists.freepascal.org> 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 can believe it. I’ll test that. > > 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. > 3. > timpfuncspez2.pp > DoThis<T> > DoThis<T,U> > 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. This sounds familiar from C# also. Is that the problem case? I feel like we already went over this but it was months ago.. generic procedure DoThis<T>(msg: T); begin writeln('DoThis$1#1:',msg); end; generic procedure DoThis<T>(msg: T; param1: T); begin writeln('DoThis$1#2:',msg,' ',param1); end; > > 4. > Why does timpfuncspez6 fail? > It works in Delphi. > The comment has an explanation, which looks wrong to me: > > generic procedure DoThis<T,U>(msg: T; param1: U; param2: TObject); > begin > end; > > begin > DoThis('aa', 'aa', TObject.Create); > // wil be specialized as DoThis(msg: integer; param1: TObject; > param2: TObject) > // so we expect an incompatible type error > DoThis(1, 1, TObject.Create); > end. That doesn’t make sense to me either so I need to study it. Both should fail actually as I designed it (for now). How does Delphi implicitly specialize this? Regards, Ryan Joseph _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal