On 11/07/2019 11:52, Ondrej Pokorny wrote:
BTW, your note in the issue report is very misleading: https://bugs.freepascal.org/view.php?id=33603#c117162.

> The idea behind "is" and "as" is that they are the sole exception to the rule and will return False and raise an error respectively if the enum is out of bounds.

IS/AS are not an exception of the rule - after a long discussion we settled down that if IS/AS is applied on a value of the same enumeration type:

var
  MyEnumValue: TEnumValue;
begin
  if MyEnumValue is TEnumValue then
// ...
end;

the compiler will expect that the result is always true. (It doesn't have to check for invalid values.)

Who is "we" in this case? I was under the impression that is/as could be used to check if the enumeration was valid or not, as a means to check if the enueration contained a valid value or not so as to avoid problems with case blocks raising access violations. I guess we've hit disagreements again.

Gareth


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to