[fpc-devel] When will the next version of FPC be released?
Michael Van Canneyt
michael at freepascal.org
Sat Jun 1 12:00:01 CEST 2019
On Fri, 31 May 2019, Ryan Joseph wrote:
>
>
>> On May 30, 2019, at 4:18 PM, Ryan Joseph <ryan at 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); // :)
I don't think this syntax is a good idea.
What with overloads ?
Procedure MyProc<T>(a:T);
Procedure MyProc(a : TObject);
How do I know which one will be called ?
Honestly, the idea of doing so many things "behind my back" is really not comforting.
Brevity goes always at the cost of understandability.
Have a look at Scala. You can express things really compactly.
But if you look at someone else's compact code (or your own code after 2 months)
you no longer understand what exactly is happening.
Pascal is meant to be readable and understandable.
Things like this diminish these qualities hugely.
Michael.
More information about the fpc-devel
mailing list