But why not just
generic TNode<T> = record
Value: T;
Next: ^TNode;
end;
?
That's possible as well, but
specialize TNode<T> is the more precise solution, especially once mode
ObjFPC supports type overloading as well like mode
Delphi does.
With PascalDragon's code in objfpc mode I get an internal error.
intvsgeneric.pas(6,28) Fatal: Internal error 2019112401
Huh?!

Seems like a regression, cause in
3.2.2 it works. Please report a bug so it isn't forgotten.
1. From PascalDragon + bytebites
The answer is great, but we need to add {$ModeSwitch advancedrecords}. For me this means I'm not good at Pascal yet. I actually got confused by the many dialect and many switches of Pascal. Other language seems more standardized.
My initial goal is to only use fpc dialect, but nowadays I think I'm also interested objfpc mode. The added benefit of using objfpc is FPC itself is implemented in it, which means a lot to me since I want to learn FPC source code.
$ModeSwitch AdvancedRecords shouldn't be required and in fact in
3.2.2 it isn't, so as said above that's a bug that needs to be fixed (by us).
And yes, there are many Pascal dialects, that's simply how it is, because the standardized Pascal dialects (
ISO Pascal and
ISO Extended Pascal never took really off 🤷♀️ ).