3 ms·
Most devs probably know operator overloading from C++ and Scala, which both go way overboard with them. Operator overloading on a limited set on operators, lik
by oweiler 5y ago
Most devs probably know operator overloading from C++ and Scala, which both go way overboard with them.
Operator overloading on a limited set on operators, like in Kotlin is fine.
- seanmcdirmid 5y agoC#’s limits are much more reasonable than Kotlin’s. The former allows overloading comparison operators with return values other than Booleans (eg if you want to return wrapped Boolean types), the latter does not (so Kotlin EDSLs rely on eq, lt style infix operators). C# on the other hand doesn’t (or didn’t?) allow for operators to be defined via extension-type overloading. Not that limitations are bad, Kotlin is just weird in them.