<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 02.07.2019 23:34, Jonas Maebe wrote:<br>
</div>
<blockquote type="cite"
cite="mid:976f1032-dc51-036b-f0ce-8cb48c454274@freepascal.org">
<pre class="moz-quote-pre" wrap="">Invalid data means undefined behaviour, always. "is" is not a special
case that is immune to this.</pre>
</blockquote>
<p>Don't you really see the need to handle invalid data with a <i>defined</i>
behavior? Enum and subrange types <i>can</i> store invalid data
and they <i>do</i> store invalid data. Be it implicit assignments
in object creation, clearing records with Default(TMyRecord),
reading records from streams etc etc. The issue is here and it
needs some solution. If you don't like "is" for this purpose, why
not to introduce a compiler intrinsic Valid(MyValue) that would
check if MyValue is within the allowed range of its type?</p>
<p>Or do you really think Valid(MyValue) should always return true
and thus be replaced with the true constant at compile time?<br>
</p>
Ondrej<br>
</body>
</html>