<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">On 05/07/2019 13:29, Sven Barth via
      fpc-devel wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAFMUeB8V=f7dFpXD98OiVHbbxNkyus2qZm3Yqrmo7cgxGEdVAw@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">
        <div>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">J. Gareth Moreton <<a
                href="mailto:gareth@moreton-family.com"
                moz-do-not-send="true">gareth@moreton-family.com</a>>
              schrieb am Fr., 5. Juli 2019, 14:02:<br>
            </div>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm glad
              we agree on the "is" operator.  Personally I would like to
              <br>
              extend it so it accepts "if (I is TMyEnum) then" when I is
              also of type <br>
              TMyEnum, since it may be the case that you're reading I
              directly from a <br>
              stream, either individually or as part of a record, in
              which case <br>
              converting I from an Integer to TMyEnum is a little
              inconvenient.  When <br>
              you get down to the compiled assembly language it
              shouldn't really <br>
              matter anyway.<br>
            </blockquote>
          </div>
        </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">It might not matter from the assembly point of
          view, but it matters from the language point of view. When we
          say that enum values only contain valid values then "myenum is
          TMyEnum" *must* always evaluate to true, because otherwise
          there's an exception of the rule that enums only contain valid
          values. </div>
        <div dir="auto"><br>
        </div>
        <div dir="auto">Regards, </div>
        <div dir="auto">Sven </div>
        <div dir="auto">
          <div class="gmail_quote">
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
            </blockquote>
          </div>
        </div>
      </div>
    </blockquote>
    <p>In this situation, the exception is kind of needed, and was
      suggested for this purpose in the first place.  If you read an
      enum from a stream or any kind of external source, then there is a
      chance it will take on an invalid value and needs to be trapped. 
      I don't think anyone wants to be forced to ditch enumerations for
      integers and C-style constants so as to not fall foul of this
      quirk.  "is" is to catch an enumeration taking on an invalid
      value, thus allowing customised error handling to be executed, so
      other expressions can be optimised on the assumption that the enum
      is definitely valid by that point.<br>
    </p>
    <p>Gareth aka. Kit<br>
    </p>
  <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>