<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div id="smartTemplate4-template">Hi,<br>
<br>
<blockquote type="cite">
<div dir="auto">Implicit function specialization would change
that, however that would mean the generation of a specialized
definition each time it is used in a different unit and for
every type. </div>
<div dir="auto"><br>
</div>
</blockquote>
<br>
This calls for a space optimizer that removes unnecessary
specializations</div>
<div><br>
</div>
<div><br>
<p>3 optimizations could one have:<br>
</p>
* If the project already has a specialization with the types in
any unit, then it will not be generated again<br>
</div>
<div><br>
</div>
<div>* If two different specialization create the same assembly,
then the previous specialization will be reused (bitwise
comparison of the code after it has been generated)<br>
</div>
<div><br>
</div>
<div>* a semantic analysis that determines whether the
specialization is actually necessary and then does not generate
anything new if it is not. </div>
<div> (e.g. if a function is generic <T: TObject>, but no
properties of T are used, but it only cast a result to T (like
e.g. a generic TList.get), then it can create the function for
TObject once and then never again for T. )<br>
</div>
<div><br>
</div>
<div>Best,<br>
Benito <br>
<br>
</div>
<div class="moz-cite-prefix">On 06.09.25 11:47, Sven Barth via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB9ARtxgvxWvjNkv1TZW3YGJd8PwrtKoRRU-RCBdfE5pKg@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>
<div class="gmail_quote gmail_quote_container">
<div dir="ltr" class="gmail_attr">michael via fpc-devel <<a
href="mailto:fpc-devel@lists.freepascal.org"
moz-do-not-send="true" class="moz-txt-link-freetext">fpc-devel@lists.freepascal.org</a>>
schrieb am Do., 4. Sep. 2025, 09:29:<br>
</div>
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On
2025-09-04 08:55, Hairy Pixels via fpc-devel wrote:<br>
> On Sep 4, 2025 at 1:43:23 PM, michael via fpc-devel<br>
> <<a href="mailto:fpc-devel@lists.freepascal.org"
target="_blank" rel="noreferrer" moz-do-not-send="true"
class="moz-txt-link-freetext">fpc-devel@lists.freepascal.org</a>>
wrote:<br>
> <br>
>> Personally, I think we already have too much
intrinsics to begin<br>
>> with;<br>
>> no matter their behaviour. But that is another
discussion<br>
>> entirely...<br>
> <br>
> How so? The reason intrinsics are used is because
they can’t be<br>
> replicated at runtime. If you remove them then you
lose that<br>
> functionality entirely.<br>
<br>
As I wrote, for some it is needed. No arguments there.<br>
<br>
But AFAIK many regular functions such as Length(),
Inc/Dec() etc. are <br>
also converted to intrinsics.<br>
<br>
No doubt for performance reasons, but I'd rather have as
little as <br>
possible "compiler magic".<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Not performance reasons, but because they need
to be usable by many types and thus can't be expressed using
ordinary Pascal in a typesafe way.</div>
<div dir="auto">Implicit function specialization would change
that, however that would mean the generation of a specialized
definition each time it is used in a different unit and for
every type. </div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven </div>
<div dir="auto">
<div class="gmail_quote gmail_quote_container">
<blockquote class="gmail_quote"
style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre wrap="" class="moz-quote-pre">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
</body>
</html>