|
|
|
|
|
by potatosareok
2652 days ago
|
|
I get Java needs it because some uses need the performance gain in terms of less ram and less pointer interdirection. I'm glad library authors of like servers or caches will be able to improve performance without weird things like unsafe byte buffers and native memory leaks. I suspect I won't ever use value types in my code though unless it's drop in to refactor from AnyVal=>AnyRef (or w/e the java equiv is). * Does accepting a value type parameter accept it by value or by ref?
* How does this play with GC? Can I get dangling ref with value type?
* How does value types play with inheritance e.g. will it be like c# and struct and they will be boxed any time treated as ref?
* How safe will it be to convert a class from being value type based to Object (w/e AnyRef equiv is). Will I need to inspect all methods that deal it now? This can probably just be resolved with a style guide like c++ can be mostly sane if you're starting a new project today with an aggressive style guide, but I just appreciated not think about this and just count on escape analysis + gc + hotspot tricks like monomorphize code paths with some counters to be good enough. |
|