News for hackers. Stuff that matters.
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.