News for hackers. Stuff that matters.
Re:Things from Python I'd miss in Go by S4M on Tuesday June 10, 2014 @10:25AM (#7872655)
> I almost never used operator overloading in C# or Java.

Dude, you can't overload operators in Java. You can overload methods of a class, but not operators. Operator overloading means that you can overload '+' for example for your particular class, which would enable you to write code like (in Java):

    Matrix a = zeroMatrix(4,4);
    Matrix b = identityMatrix(4,4);
    Matrix c = a+b;
You can't do that, so you would have to write:

    Matrix c= a.add(b);
Which makes your code verbose and makes Java (and Go) painful for doing numerical analysis.
Re:Things from Python I'd miss in Go by nordsieck on Tuesday June 10, 2014 @10:45AM (#7872775)
It's important to note that numerical calculation is a domain particularly suited to operator overloading simply because the underlying domain (math) already uses operator overloading heavily (e.g. multiplication means something different when done on scalars and vectors, but in both cases it is well defined and in common usage).
Re:Things from Python I'd miss in Go by Someone on Tuesday June 10, 2014 @12:10PM (#7873386)
You should leave out the 'overloading':

- Math (and it's very close relative logic) are the only domains that use operators, period.

- other domains use overloading; homonyms are very common.

Re:Things from Python I'd miss in Go by drdaeman on Tuesday June 10, 2014 @11:24AM (#7873035)
Which leads us to that ugly a.equals(b) instead of sane a == b. When not abused, operator overloading is a bless.
Re:Things from Python I'd miss in Go by rmrfrmrf on Tuesday June 10, 2014 @04:26PM (#7875106)
Except that a == b and a.equals(b) are two different things.
Re:Things from Python I'd miss in Go by philbarr on Tuesday June 10, 2014 @10:46AM (#7872781)
As it stands you can't in Java but you can in C#, although it's usually a really bad idea.
Re:Things from Python I'd miss in Go by S4M on Tuesday June 10, 2014 @11:08AM (#7872927)
My comment only applies for Java - I don't know C#. As you say, it's usually a bad idea but it's quite reasonable to do for numerical analysis, as your sibling comment says.
Re:Things from Python I'd miss in Go by jamra on Wednesday June 11, 2014 @03:26PM (#7879941)
You are right. Can you tell which language I spent more time with?