3 ms·
I can't wait for Value Types to land! The contortions my code has to go through to fit in RAM and avoid fighting the garbage collector drives me nuts. Problem
by willvarfar 8y ago
I can't wait for Value Types to land! The contortions my code has to go through to fit in RAM and avoid fighting the garbage collector drives me nuts. Problems that might fit in a few megabytes in, say, C/C++ can take gigabytes in JVM. I have always looked at the C# structs with envy.
Rah rah I hope the authors peek on HN and see that their work has baying fans :)
- karianna 8y agoI help run OpenJDK advocacy - and yeah we notice . The authors aren’t always able to jump in on threads but we collate feedback for them
- pjmlp 8y agoC# has much more than only structs. You can do manual memory management, GC free code blocks and there is unsafe. Additionally C# 7.x has safe stack allocation, spans, references to stack allocated data. Looking forward to have some of those goodies in Java as well.
- zamalek 8y agoValue types are stack allocated types (unless they are a member of a reference type). You might be referring to stack-only value types, which are prevented from being copied to the heap.
- pjmlp 8y agoI am referring to array values. Up to 7.3 you could only stack allocate arrays (alloca() style) inside unsafe code blocks. Starting with 7.3 you can safely stack allocate array of value types.
- apta 8y ago> Additionally C# 7.x has safe stack allocation, spans, references to stack allocated data. How much of those are the direct result of having value types in the language? As far as the other features you mentioned, it would be nice to have them in the JVM as well.
- pjmlp 8y agoAll of them. They were already available in other languages like Modula-3 and Oberon(-2) before Java came to be, but Java team decided it was too complicated for their target audience. Just like Sun was religiously against AOT, a feature only available in commercial third party JDKs, they also believed it was a matter of making the JIT good enough for escape analysis. Thankfully the .NET team had other beliefs.
- repolfx 8y agoWhat data structure design are you using that takes requirements from megabytes to gigabytes?