Re:Project Valhalla, Explained: How a Decade of Work Arrives...
by tikotus on Friday June 19, 2026 @05:59AM
(#48596807)
What about the case of just needing one, not a collection? And when a function receives a Point, how does it know if it's a value or a reference?
Re:Project Valhalla, Explained: How a Decade of Work Arrives...
by jayd16 on Saturday June 20, 2026 @12:59PM
(#48610806)
It would really break the GC or the type system if you did that. If you return a single point out of a 100k long array, it has to pin the array? How do you track the GC root? Struct array elements need back pointers?
Conversely, if it auto-copies now you have to contend with runtime state changing the pass semantics?
What is unclear to me is why the decision to use a Point instance as a value or as a reference is made in the class definition rather than by the caller.
> Point[] point = new Point[10];
For the same class, I might need an array of values in one place and an array of references elsewhere within the same codebase.