<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>I like the idea of using existing operators since that avoids
      extra intrinsics and the risk of breaking code that uses a
      function with the same proposed name.</p>
    <p>The "as" operator is possible for assignment, although I'm not
      the biggest fan of run-time errors (although they have their
      uses).  The "is" operator sounds like a good partner as well, like
      how as and is are used to check if an object belongs to a
      particular class family.</p>
    <p>e.g. "If (Value is TEnumType) then" returning False if it is
      outside of the range.</p>
    <p>Though I'm only a developer and not one of the moderators or
      administrators, the patch in principle has my blessing.  There
      might be options for optimisation further down the line, but we'll
      get to that later!<br>
    </p>
    <p>Gareth aka. Kit<br>
    </p>
    <div class="moz-cite-prefix">On 02/07/2019 20:15, Michael Van
      Canneyt wrote:<br>
    </div>
    <blockquote type="cite"
      cite="mid:alpine.DEB.2.21.1907022113370.6995@home">
      <br>
      <br>
      Don't forget to check the post of Ondrej.
      <br>
      <br>
      Personally, I think using 'as' to convert an integer to an enum
      with range
      <br>
      check is still the best approach. It does not require new
      intrinsics (far
      <br>
      too many of those already) and does what it says. To simply check
      if an
      <br>
      integer is a valid enum, I think 'is' would be equally suitable.
      <br>
      <br>
      Michael.
      <br>
      <br>
      On Tue, 2 Jul 2019, J. Gareth Moreton wrote:
      <br>
      <br>
      <blockquote type="cite">Aah, thank you.
        <br>
        <br>
        On 02/07/2019 19:56, Michael Van Canneyt wrote:
        <br>
        <blockquote type="cite">
          <br>
          <br>
          On Tue, 2 Jul 2019, J. Gareth Moreton wrote:
          <br>
          <br>
          <blockquote type="cite">I don't recall a conversation where
            such an intrinsic is seen as desirable, but if such a
            construct is desirable, then that's a good thing since it
            will help patch up this problem.
            <br>
            <br>
            As for the Delphi problem, it's second-hand information I
            heard from a friend who uses Delphi at work and something
            about not handling out-of-range enumerations was a
            deal-breaker from not using FPC.  I may have some details
            wrong though.  But all that side, would development of an
            intrinsic be an acceptable solution, and what name are we
            going for? (One has to be careful we don't break existing
            code if possible)
            <br>
          </blockquote>
          <br>
          <br>
          See this thread:
          <br>
          <br>
<a class="moz-txt-link-freetext" href="https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg35100.html">https://www.mail-archive.com/fpc-devel@lists.freepascal.org/msg35100.html</a>
          <br>
          <br>
          Michael.
          <br>
          <br>
          _______________________________________________
          <br>
          fpc-devel maillist  -  <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
          <br>
<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>
          <br>
        </blockquote>
        <br>
        <br>
        ---
        <br>
        This email has been checked for viruses by Avast antivirus
        software.
        <br>
        <a class="moz-txt-link-freetext" href="https://www.avast.com/antivirus">https://www.avast.com/antivirus</a>
        <br>
        <br>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
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>
  <div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
        <tr>
        <td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
                <td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
                </td>
        </tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>