Hi Michael,

I'm glad we agree on the "is" operator.  Personally I would like to extend it so it accepts "if (I is TMyEnum) then" when I is also of type TMyEnum, since it may be the case that you're reading I directly from a stream, either individually or as part of a record, in which case converting I from an Integer to TMyEnum is a little inconvenient.  When you get down to the compiled assembly language it shouldn't really matter anyway.

For enumerations with holes, having "is" return False if a value is within one of these holes would require more complex code, at least to work out how to programmatically cover these holes with conditions and not pollute the simpler version where all elements are contiguous.

Gareth aka. Kit


---
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