<div dir="auto"><div><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>> schrieb am Di., 25. Nov. 2025, 17:29:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <div>On 25/11/2025 16:14, Hairy Pixels via
      fpc-devel wrote:<br>
    </div>
    <blockquote type="cite">
      
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Nov 25, 2025 at 9:55:46 PM,
          Martin Frb via fpc-devel <<a href="mailto:fpc-devel@lists.freepascal.org" target="_blank" rel="noreferrer">fpc-devel@lists.freepascal.org</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" type="cite">
          <div>Thanks, which just for confirmation brings up a follow up
            question. (I haven't used generic function much yet, so
            maybe I miss something)<br>
            <br>
            <font face="monospace">          function  Foo   (aParam:
              Integer): integer;<br>
                generic function  Foo<T>(aParam: t)      :
              integer;</font><br>
            <br>
            <br>
          </div>
        </blockquote>
      </div>
      <br>
      <div dir="ltr"> <br>
      </div>
      <div dir="ltr">yes those are two different functions. The generic
        function is just a template which includes the parsed tokens and
        is named with $X where X is the number of generic parameters.
        Only at the time of specialization is the code generated, until
        the it's just an array of tokens.</div>
      <div dir="ltr"><br>
      </div>
      <div dir="ltr">there is a {$modeswitch
        implicitfunctionspecialization} mode switch ( my work so I
        apologize for the bugs 😂) which infers the parameter type so
        that foo('abc') becomes foo<String>('String').</div>
      <br>
    </blockquote>
    <br>
    So then with that switch, what will <br>
      foo(1)<br>
    <br>
    resolve to?<br>
    <br>
    - Always the non generic<br>
    - Always the generic<br>
    - Which every is first in scope<br>
    ?</div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">The non-generic is preferred as it might provide a better concrete implementation. </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>