[fpc-devel] Thoughts on being able to declare "pointer-to-type" parameters directly in method signatures?

Ryan Joseph genericptr at gmail.com
Fri Jun 7 22:45:33 CEST 2019



> On Jun 7, 2019, at 3:50 PM, Sven Barth via fpc-devel <fpc-devel at lists.freepascal.org> wrote:
> 
>   generic procedure MemCopy<T>(Dest, Src: specialize TPointerType<T>.PT; Len: PtrUInt);
>   begin
>     while Len > 0 do begin
>       Dest^ := Src^;
>       Inc(Dest);
>       Inc(Src);
>       Dec(Len);
>     end;
>   end;

May I ask where the syntax for “specialize” came from? Delphi doesn’t use it nor does any other language out there. Honestly it’s extremely verbose and makes me want to avoid generics sometimes. I just don’t get it. I will say that I like the “generic” addition to type declarations though because it makes it more clear what they are.

Regards,
	Ryan Joseph




More information about the fpc-devel mailing list