Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> 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.



That 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: