""" Strangely this code would work if `b` was set to any of the first four enums, but if set to `flan` or later, it would throw the exception: System.InvalidCastException: Value is not a convertible object: System.Int32 to Test+MyEnum The failure happened in CobraImp.DynamicCompare which calls Convert.ChangeType which is apparently fickle regarding enums! Same behavior on both Mono and .NET A special case in CobraImp.DynamicCompare was required to make this work Reported by eric.sellon """ class Test enum MyEnum burrito carne chili enchilada flan taco ugly def chainedCompare(left, middle, right) as bool return (left < middle) and (middle < right) def main a = 3 b = MyEnum.flan c = 5 assert .chainedCompare(a, b, c)