3 ms·
They also insists Java is pass-by-value whereas technically it's pass-by-value for primitive unboxed types and call-by-sharing for others. The reason of which e
by wyuenho 10y ago
They also insists Java is pass-by-value whereas technically it's pass-by-value for primitive unboxed types and call-by-sharing for others. The reason of which escapes me.
- twic 10y ago"Call-by-sharing" is just a different, and IMHO unnecessary and unhelpful, name for pass-by-value when the values happen to be pointers. To put it another way, the inconsistency in Java isn't that primitives and objects are passed differently, it's that they're stored differently. Given how they're stored, they're passed the same way.
- paulddraper 10y agoSince primitives are immutable have value-equality, it doesn't matter. If your cognitive model prefers to think of everything as pass pointer by value, you think that.