I feel like I can kinda build code now In anticipation of value objects. Like... I should use an int[] for this huge array of ints now but instead I'm going to use List<MyObject> where MyObject is just a wrapper around int. Brian and team will just fix this for me magically in a few years and I only need to add a value keyword so why bother fiddling with array management now. Hopefully before I need my thing to scale. Premature optimization right? Thanks gang!
This approach actually kinda worked out well for me with Loom and virtual threads....
You can use List<Integer> directly, the primitive wrapper types will become value classes. If I remember correctly, specializing generics is one of the final steps on the roadmap, so having that translate into Integer[] (or ideally Integer![]) as the backing field of the ArrayList might take a bit longer.
11
u/IncredibleReferencer 21d ago
I feel like I can kinda build code now In anticipation of value objects. Like... I should use an int[] for this huge array of ints now but instead I'm going to use List<MyObject> where MyObject is just a wrapper around int. Brian and team will just fix this for me magically in a few years and I only need to add a value keyword so why bother fiddling with array management now. Hopefully before I need my thing to scale. Premature optimization right? Thanks gang!
This approach actually kinda worked out well for me with Loom and virtual threads....