News for hackers. Stuff that matters.
Re:Swift at Apple: Migrating the Password Monitoring Service... by cogman10 on Tuesday June 03, 2025 @06:44PM (#44175576)
I'm not sure with the semantics of structs for C#.

What java is getting in the future is immutable data values where the reference is the value.

When you have something like

   class Foo {
     int a;
     int b;
   }

   var c = new Foo();
in java, effectively the representation of `c` is a reference which ultimately points to the heap storage locations of `a, b`. In C++ terms, you could think of the interactions as being `c->b`.

When values land, the representation of `c` can instead be (the JVM gets to decide, it could keep the old definition for various performance reasons) something like [type, a, b]. Or in C++ terms the memory layout can be analogous to the following:

    struct Foo { int a, int b };

    struct Foo c;
    c.a = 1;
    c.b = 2;
Re:Swift at Apple: Migrating the Password Monitoring Service... by CharlieDigital on Wednesday June 04, 2025 @07:21AM (#44179471)