Skip to content

Comment on Project Valhalla, Simple as it can be, but not simplerparent

Comments

In C#, value types and reference types are two separate kind of types, value types are pass by copy (like C structs) and generics where clauses have coloring (struct constraints [1]).

In Java, value types are immutable so the VM can pass by value or by copy, as a user you don't see the difference and there are backward compatible (per the article), you don't need to recompile the user code when you replace an existing class by a value class.

C# has value types since the beginning so primitive types are value types while in Java it seems there will be 3 kinds of types instead of 2.

[1] https://learn.microsoft.com/en-us/dotnet/csharp/programming-...

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.