News for hackers. Stuff that matters.
Re:dotNET (OK, C#) gets union types by goto11 on Sunday May 24, 2026 @03:45AM (#48255348)
C# was always better than Java as a language. The strength of Java is the ecosystem, and Java being open source and cross-platform from the beginning.
Re:dotNET (OK, C#) gets union types by littlecranky67 on Sunday May 24, 2026 @04:38AM (#48255628)
Java wasn’t open source at all from the beginning.
Re:dotNET (OK, C#) gets union types by pjmlp on Sunday May 24, 2026 @05:59AM (#48255986)
No, but it was free/gratis distributed on almost every developer magazine shipping with CDs.

One of the reasons why it took off.

Re:dotNET (OK, C#) gets union types by hackerqwe on Sunday May 24, 2026 @05:36AM (#48255896)
And the binaries, the default sdk when using java, i.e. oracle jdk, is still not open source, encumbered with a mine field of legalese. For a long time it also included malware as ask toolbar. Stay away.
Re:dotNET (OK, C#) gets union types by pjmlp on Sunday May 24, 2026 @06:02AM (#48255999)
To the point that after all the drama with J++ that lead to .NET and C# development, Microsoft nowadays is also an OpenJDK contributor with their own distributions, and official developer advocacy channels on YouTube, conferences and devblogs.

Turns out they really want to have plenty of Java development on Azure as well.

Re:dotNET (OK, C#) gets union types by pregnenolone on Sunday May 24, 2026 @07:17AM (#48256359)
Language design isn't just about adding every possible feature. For example, someone mentioned operator overloading. As someone who has written a lot of Scala, I think operator overloading would be a very bad feature for an enterprise language like Java which needs to be consistent above all else. I never understood the obsession some people have with the C# vs Java debate anyway. Generally, both languages are very good at what they do, each having its own set of advantages and disadvantages. Regardless, a developer can pick up the other language with basically no effort.
Re:dotNET (OK, C#) gets union types by xigoi on Sunday May 24, 2026 @10:30AM (#48257554)
> I think operator overloading would be a very bad feature for an enterprise language like Java which needs to be consistent above all else.

Operator overloading increases consistency. Instead of having

  int a = b + c;
  CustomNumberType x = y.add(z);
you have

  int a = b + c;
  CustomNumberType x = y + z;
Re:dotNET (OK, C#) gets union types by fragmede on Sunday May 24, 2026 @10:36AM (#48257597)
The problem with operator overloading is it makes things confusing when mixing types and let's programmers write confusing code.

    Person x;
    Job y;
    CustomType z = x + y;
WTF is Z?

Is the argument, anyway, I support operator overloading.

Re:dotNET (OK, C#) gets union types by xigoi on Sunday May 24, 2026 @11:27AM (#48258040)
> WTF is Z?

Hopefully a type error, because no sane programmer would implement addition like this. Obviously an insane programmer could, but that’s not the fault of operator overloading. The following code is exactly as confusing:

    Person x;
    Job y;
    CustomType z = add(x, y);
Re:dotNET (OK, C#) gets union types by tpxl on Sunday May 24, 2026 @01:03PM (#48259023)
I don't know; you can bit shift an output stream by a string (or char array) in C++ (std::cout << "Hello, world!"). That seems pretty mad to me.
Re:dotNET (OK, C#) gets union types by xigoi on Sunday May 24, 2026 @01:14PM (#48259112)
Are you trying to imply that Bjarne Stroustrup is a sane programmer?
Re:dotNET (OK, C#) gets union types by bonesss on Sunday May 24, 2026 @03:30PM (#48260284)
> WTF is Z?

Take a person, add a job, you get an Employee or EmployedPerson. Person.add(job).

I agree overloading can create footguns, but domain concepts should make a lot of sense in context when basic arithmetic operations are performed on them. Party = Meeting + Booze.

Custom operators are a big assistance for DSLs, and overloading can also aide their creation and elegance. Part of the “awesome but don’t be a jerk about it” toolbox.

Re:dotNET (OK, C#) gets union types by joe_mwangi on Sunday May 24, 2026 @04:03PM (#48260546)
Java’s planned approach is more like typeclass-style interfaces than unrestricted operator overloading. Types opt into core-defined operator contracts, rather than every library inventing arbitrary meanings for symbols.
Re:dotNET (OK, C#) gets union types by zardo on Monday May 25, 2026 @11:14AM (#48267844)
Yeah it's bad when it's abused, so don't abuse it.

But not having operator overloading when dealing with vectors is maddening.

Re:dotNET (OK, C#) gets union types by Salgat on Sunday May 24, 2026 @11:33AM (#48258088)
That used to be the case, but I would argue that C#'s ecosystem is just as competitive now. For our backend tech stack at work, all of our libraries used are open source nugets. Back 15 years ago, paid nugets were definitely more standard.