Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2022-06

Calling undefined function pointers in generics

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hairy Pixels

This code snippet will give a compiler error "Syntax error, ";" expected but "(“ found”. It’s an unspecialized generic type so I would think it should compile and only attempt to validate the parameters when the function is specialized.

generic procedure Perform<T>(func: T);
begin
  func(1);
end;

Regards,
Ryan Joseph

Reply by email

Hairy Pixels
to Hairy Pixels

NOTE: I’m replying to this and CC’ing Sven so hopefully he can see it.

Show quoted text 12 lines
On Jun 19, 2022, at 10:05 AM, Hairy Pixels wrote: This code snippet will give a compiler error "Syntax error, ";" expected but "(“ found”. It’s an unspecialized generic type so I would think it should compile and only attempt to validate the parameters when the function is specialized. generic procedure Perform<T>(func: T); begin func(1); end; Regards, Ryan Joseph

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Hairy Pixels

Hairy Pixels schrieb am Mo., 20. Juni 2022, 03:38:

Show quoted text 14 lines
NOTE: I’m replying to this and CC’ing Sven so hopefully he can see it. > On Jun 19, 2022, at 10:05 AM, Hairy Pixels wrote: > > This code snippet will give a compiler error "Syntax error, ";" expected but "(“ found”. It’s an unspecialized generic type so I would think it should compile and only attempt to validate the parameters when the function is specialized. > > generic procedure Perform<T>(func: T); > begin > func(1); > end;

Please report a bug.

Regards,
Sven

Reply by email

Hairy Pixels
to Sven Barth
On Jun 20, 2022, at 7:12 PM, Sven Barth wrote: Please report a bug.

Done. https://gitlab.com/freepascal.org/fpc/source/-/issues/39794. I may actually try to fix this myself since I may know what the problem is.

And on that note did you notice I made a PR for your idea of a generic keywords mode switch? It’s been at least a couple years but I believe this is what you wanted. If not please leave some notes in the PR and I can fix it.

https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/240

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Hairy Pixels

Hairy Pixels schrieb am Mo., 20. Juni 2022, 15:12:

Show quoted text 17 lines
> On Jun 20, 2022, at 7:12 PM, Sven Barth wrote: > > Please report a bug. > Done. https://gitlab.com/freepascal.org/fpc/source/-/issues/39794. I may actually try to fix this myself since I may know what the problem is. And on that note did you notice I made a PR for your idea of a generic keywords mode switch? It’s been at least a couple years but I believe this is what you wanted. If not please leave some notes in the PR and I can fix it. https://gitlab.com/freepascal.org/fpc/source/-/merge_requests/240

I did reply to your mail on fpc-devel, but maybe you didn't see it for the same reason I don't see your mail, so here again: I won't apply this before backwards compatible type overloading isn't working in non-Delphi modes as well.

Regards,
Sven

Reply by email