<div dir="auto"><div><div class="gmail_quote"><div dir="ltr">Ondrej Pokorny <<a href="mailto:lazarus@kluug.net">lazarus@kluug.net</a>> schrieb am Fr., 13. Apr. 2018, 12:52:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF">
<div class="m_7860075233186958794moz-cite-prefix">On 02.07.2017 18:55, Ondrej Pokorny
wrote:<br>
</div>
<blockquote type="cite">
<div class="m_7860075233186958794moz-text-flowed" style="font-family:-moz-fixed;font-size:14px" lang="x-unicode">On 02.07.2017 18:49, Jonas
Maebe wrote: <br>
<blockquote type="cite" style="color:#000000">No, there is no
built-in checked conversion from integer to arbitrary
enumeration types. That's why I suggested in the bug report
that started this thread to file a feature request for such a
conversion. <br>
</blockquote>
<br>
Very good :) <br>
<br>
<blockquote type="cite" style="color:#000000">
<blockquote type="cite" style="color:#000000">Are there any
disadvantages of the enum-AS operator that prevents its
introduction? <br>
</blockquote>
<br>
Someone else could already have code that overloads the
AS-operator in this way, and such a change would break this
(you cannot overload operators with a built-in meaning). I
would be in favour of a new intrinsic. <br>
</blockquote>
<br>
If I am not mistaken, the AS operator cannot be overloaded - so
no chance to break legacy code here.</div>
</blockquote>
<br>
Because<br>
<br>
1.) you agreed that a built-in checked conversion from integer to
arbitrary enumeration type is wanted and<br>
2.) the AS-operator cannot be overloaded and thus the only argument
against enum support for AS is not valid<br>
<br>
I introduced the AS operator for enumerators in
<a class="m_7860075233186958794moz-txt-link-freetext" href="https://bugs.freepascal.org/view.php?id=33603" target="_blank" rel="noreferrer">https://bugs.freepascal.org/view.php?id=33603</a></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">What about enums with holes? </div><div dir="auto">Also for constants there could be a compile time check. </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"><div text="#000000" bgcolor="#FFFFFF"><br></div>
</blockquote></div></div></div>