Hacker News new | ask | show | jobs
by seanmcdirmid 2919 days ago
C# supports operator overloading but not custom operators. That means vectors get to use the plus operator for addition, but no Scalaesque ~~/ operators.

C# is not a language that is generally criticized for operator soup like the ones that support custom operators.

2 comments

Counter-examples:

* C++ uses bitshift operators for IO. The (in?)famous

    std::cout << "hello world" << std::endl;
Which is such an improvement over

    puts("hello world");
* Ruby on Rails components sometimes redefines `=` as a hash merge. E.g. this

    config.action_mailer.default_options = {from: 'no-reply@example.com'}
actually adds `from` to the default options instead of overriding it completely.
C# may not be generally criticized for that. But there are certainly C# code bases that do get so criticized.