> On May 30, 2019, at 4:18 PM, Ryan Joseph <r...@thealchemistguild.com> wrote:
> 
> I didn’t realize generic functions were in the trunk. I’m not sure I got this 
> implemented properly so it requires some code review but can we try to 
> include “implicitfunctionspecialization” mode switch in the next release 
> along the with actual feature? https://bugs.freepascal.org/view.php?id=35261
> 

{ got blocked again, attempting to resend }

I didn’t realize generic functions were in the trunk. I’m not sure I got this 
implemented properly so it requires some code review but can we try to include 
“implicitfunctionspecialization” mode switch in the next release along the with 
actual feature? https://bugs.freepascal.org/view.php?id=35261

Specifically, for some time now I wanted to make a “ClearMem" function that 
doesn’t require passing the type but the insanely verbose syntax of generic 
functions makes it even longer. Honestly the syntax is so intrusive in ObjFPC 
mode that I would avoid using it all together. 

What we have now:

var
 pt: TPoint;
begin
        FillChar(pt, sizeof(TPoint), 0);

Specialization with generics:

        specialize ClearMem<TPoint>(pt);

With implicit specialization:

ClearMem(pt); // :)

Regards,
        Ryan Joseph

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to