I find it inconsistent that to define equality, I should define Base.:(==) instead of Base.isequal, but to define inequality, I should define Base.isless instead of Base.:(<). What’s the rationale for this?
In general, if I define a custom struct and I define a custom equality / comparison operator, what are the methods that I should define to obtain a consistent behavior?
In operators.jl, the generic isless method for Real relies on <, so you should actually define < for a custom type, not isless, which isn’t necessary for Real subtypes (if that’s what you’re interested in).
Well I am confused about this. Are there guidelines written somewhere, of when and which operators I should define for consistent behavior? I suppose I need to know whether isless is defined in terms of < or the other way around, for each class of types… and so on. Of course I could just define them all, but that is not efficient