3 ms·
> In languages that have it I've never used operator overloading to produce anything good or that was obviously better than just using methods. I used a Scala
by rvense 2y ago
> In languages that have it I've never used operator overloading to produce anything good or that was obviously better than just using methods.
I used a Scala library for S3 once that overloaded + to mean upload.
var bucket; var file;
bucket + file;
Which is obviously bad and unnecessary.
It's really a feature that should be used very rarely by those who make basic libraries, but there it can make a lot of sense - data structures, numeric types, etc.
- monksy 2y agoThat says more about the library design more than it does about the library. There are much better examples of the operator overloading for example cons: item :: item2 Later you can break that down in pattern matching.