I’m tired of being told that I can’t compare `some...
# announcements
t
I’m tired of being told that I can’t compare
someByte == 13u
. Is it possible to implement an unbalanced equals override that will let me compare these without having to put toUByte() or toUInt() in everywhere. I tried something like: fun UInt.equals(b:UByte) : Boolean { return this == b.toUInt() } (and the reverse as well) But == sites still complain
d
infix fun UByte.eq(other: UInt) = toUInt() == other
k
t
Dereck, with your suggestion, I’d need to evaluate not
someByte == 13u
, but rather
someByte eq 13u
. Is that correct?
👌 1