[fpc-pascal] Generic: generic type in generic methods

2015-02-07 Thread silvioprog
Hello, I'm trying to port some of my drafts from Delphi to FPC, but I'm taking some problems. See this sample: http://pastebin.com/Jb6UjDX9 Notice that I specialized the generic types directly in the method call. This is very useful, and allows one to use a clean syntax for direct calls in metho

[fpc-pascal] Generic: restricting a specialized type

2015-02-07 Thread silvioprog
Hello, I'm trying to port a Delphi code to FPC, and it has a structure like: TType = class(TObject) end; TTest = class(TObject) end; TFoo = class(TType) end; TBar = class(TTest) end; I.e., T1 accepts any type, but T2 accepts _only_ TType and/or their descendants. I tried the