News for hackers. Stuff that matters.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by rf15 on Friday June 19, 2026 @04:18AM (#48596159)
How .net got so many things right where java did not is a mystery to me, but appreciated (it has its own flaws, of course). Java, in my understanding, is still of core relevance to Oracle, and tied into a lot of contracts that require very little effort from them to maintain. But you are correct in observing that they want to be a datacentre/compute business more and more these days; they may have in fact overcomitted to this due to the AI craze, since shareholders are already complaining.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by Someone on Friday June 19, 2026 @06:48AM (#48597097)
> How .net got so many things right where java did not is a mystery to me

Part of the reason for that is that Java is older. https://en.wikipedia.org/wiki/C_Sharp_(programming_language)...:

“In interviews and technical papers, he has stated that flaws in most major programming languages (e.g. C++, Java, Delphi, and Smalltalk) drove the fundamentals of the Common Language Runtime (CLR), which, in turn, drove the design of the C# language.”

Also, some of Java’s design warts may be there because Java was initially envisioned for much smaller devices.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by toyg on Friday June 19, 2026 @07:09AM (#48597250)
This. C# was basically always meant to be "Java but done right". It came several years later, after Microsoft was legally barred from "EEE"-ing Java and required a direct competitor.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by cm2187 on Friday June 19, 2026 @07:55AM (#48597562)
But what I don’t get reading the original article is that they present how to insert struct in an object oriented language as an intractable problem, whereas a good implementation with .net (as far as I can tell) has been out there for nearly 30 years. And C# was shameless about stealing from other languages.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @08:50AM (#48597988)
The problem is how to do it without breaking ABI, 30 years of Maven Central is very relevant, Java isn't doing a Python over value types.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by cm2187 on Friday June 19, 2026 @08:56AM (#48598040)
But if you define a new type, how is that breaking backward compatibility?
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @09:16AM (#48598224)
Because that is missing the point.

All the types that are value types in semantics, e.g. Optional, should be proper value types on Valhalla.

Additionally, they should be compatible with existing code that expects them as parameters, fields,.... without being recompiled from source.

If it is a complete new type without backwards compatibility, no one is going to adopt it, other than a few niche cases.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by gf000 on Saturday June 20, 2026 @05:18AM (#48607694)
Well, my old code can have a List<Object>, and I can pass my new type into it and have it do some operations. Let alone with reflection - so backwards compatibility is more complex than that.

As for structs, Java avoids e.g. tearing issues with making them immutable, while it is easy to optimize it to local modification under the hood.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by Someone on Friday June 19, 2026 @08:53AM (#48598018)
> how to insert struct in an object oriented language as an intractable problem, whereas a good implementation with .net (as far as I can tell) has been out there for nearly 30 years. And C# was shameless about stealing from other languages.

I think (but may be wrong) their concerns are about the insert part. C# always had structs, Java wants to add them in a backward-compatible way. They want, for example, existing generic container classes pulled in from a .jar (i.e. already compiled) to support Java value types.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by Zardoz84 on Friday June 19, 2026 @09:45AM (#48598528)
Dlang this this before. You have classes and struts, with different semantics.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Saturday June 20, 2026 @06:37AM (#48608151)
Unfortunately D will remain a niche language due to various reasons, and is D not Dlang.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @08:49AM (#48597980)
Ironically, they still do need Java for Azure, https://devblogs.microsoft.com/java
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by newsoftheday on Friday June 19, 2026 @10:50AM (#48599275)
> It came several years later, after Microsoft was legally barred

That is an eloquent way of re-writing the history of Microsoft stealing Java and not being allowed to get away with it.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by toyg on Friday June 19, 2026 @11:08AM (#48599489)
They didn't "steal" anything, iirc; they started as a legitimate licensee and then tried their usual embrace/extend/extinguish as "J++" (the EEE I mentioned). Sun sued for breach of license and won, barring Microsoft from extending Java outside of the (Sun-controlled) process. So they dropped it and built their own version, with blackjack and hookers.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by dingi on Friday June 19, 2026 @12:12PM (#48600178)
> So they dropped it and built their own version, with blackjack and hookers.

This cracked me up

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by jbellis on Friday June 19, 2026 @05:25AM (#48596603)
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @08:52AM (#48598004)
Which recently decided that Go was a better option than C# for the Typescript rewrite, exactly because not all decisions were done correctly to make C# a better fit for the problem.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by Rohansi on Friday June 19, 2026 @10:37AM (#48599119)
Go was chosen mainly because it aligned more with how the existing compiler is designed. They did not want to redesign the compiler which eliminated C# as a choice. So Go is apparently just a better fit for quickly porting JavaScript code to.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @11:17AM (#48599611)
That was the original motivation yes, although they acknowledged later that the weaker type system from Go required redesigning the data structures anyway.

And as proven in the recent announcement, they had to rewrite parcel from C++ into Go, as they didn't found a comparable library in Go ecosystem.

There is also another interview, where again they mention having used AI as tool for code rewriting as well.

Also to note that it was pointed out that Native AOT wasn't up to the job, again something that both Java and C# failed not having done it properly from day one.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by Rohansi on Friday June 19, 2026 @01:51PM (#48601148)
They said the prototyped in a few languages before settling on Go. Based on what you said it sounds like they didn't do a great job at that and stuck with their decision anyway.

> Also to note that it was pointed out that Native AOT wasn't up to the job, again something that both Java and C# failed not having done it properly from day one.

It's been working fine for a few years now. The only problem I know is there is little to no reflection allowed (by design) so a lot of code out there is not compatible with it yet. Not sure if that's what turned the TypeScript team away from it.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by pjmlp on Friday June 19, 2026 @03:59PM (#48602595)
Yes, see BUILD 2025 talk for example, the section on "extreme refactoring" regarding the ASTs,

https://youtu.be/UJfF3-13aFo?t=1453

As for the AOT part, one would expect that being all Microsoft, they could work together to fix whatever were the issues with Native AOT.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by amitport on Friday June 19, 2026 @05:27AM (#48596614)
The mystery of why .NET got so many things right is simply that C# was built several years later by the exact same Microsoft engineers who had previously worked on extending Java, giving them a perfect blank slate to fix the architectural flaws they had already encountered

Second mover advantage.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by ah1508 on Friday June 19, 2026 @10:39AM (#48599148)
virtual thread instead of async/await is a counter example.

Java is more used than C#, they can wait before delivering a new feature (given their leader position) but cannot deliver a flawed implementation that would stay in the language forever. Glad to have virtual threads and the backward compatibility that comes with it instead a Async version of sync methods + async and await keywords all over the code and Task as a return type in my interfaces methods to allow implementations to do non blocking I/O calls if they need.

I use Java and C# and appreciate them both.

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by amitport on Friday June 19, 2026 @11:50AM (#48599968)
C# did not ship with async/await, and Java didn't have virtual threads back then. I am specifically referring to the initial choices made in C#'s foundation.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by int_19h on Saturday June 20, 2026 @12:35AM (#48606373)
.NET had green threads (fibers) in its first iteration. They were abandoned because practical use of .NET was also FFI-heavy - WinForms etc - and native code generally doesn't play well with non-native threads. The benefit of async is that it desugars into callbacks with state, which is something that can be easily expressed in terms of the C ABI (which is the de facto interop standard on all mainstream platforms). Which is why you can have async C# code calling into async C++ or Rust code, or for that matter async Python calling into async C#. Given that .NET was historically supposed to be a multi-language runtime, before they went all in on C#, async made a lot of sense.
Re:Project Valhalla, Explained: How a Decade of Work Arrives... by lyu07282 on Friday June 19, 2026 @12:20PM (#48600239)
> giving them a perfect blank slate to fix the architectural flaws they had already encountered

and then they make everything nullable by default in c#...

Re:Project Valhalla, Explained: How a Decade of Work Arrives... by za3faran on Friday June 19, 2026 @05:59PM (#48603771)
What things are you referring to? Especially after the many features that Java gained after Java 8.