I am trying to overload operator compare.
however the right hand side is nil.
what does one do in operator compare if the right hand side is nil?
throw an exception?
throw or raise?
what?
a value is never < or > nil
it is = Nil or <> Nil
so you would need to make that check BEFORE you attempt < or >
It will send Nil to your Operator_Compare and you should return 1 or -1 depending on how you’d want it sorted, if you care.
Function Operator_Compare (other As MyClass) As Integer
if other is nil then
return 1 // or -1
end if
End Function
BTW, this is why I always use o is nil
to bypass any custom Operator_Compare, or I make a clear note as to why I want Operator_Compare to do the work.