On 15.04.2018 0:05, Martok wrote:
All this is not quite as easy to get right as it seems on the surface.
But I do like the the "v is TEnum" operator from the other side of
this thread, regardless of where this goes...
I don't want to force FPC to any direction. I just want to have a simple
built-in method to validate an ordinal value against an enum. Be it the
AS/IS operator or a new compiler intrinsic. I chose the AS/IS operators
because they are easier to implement for me.
It should not change any kind of religion or anything else, they are
just helpful tools.
Please note that I want to support all ordinal values on the left side
of the operator. You can then validate a value of variable of the enum
type itself. Then you can use code like:
if not (E is TMyEnum) then
// handle your error here
case E of
// handle possible valid values not listed above
That should be OK for all of us.
fpc-devel maillist - firstname.lastname@example.org