4 ms·
But if you define a new type, how is that breaking backward compatibility?
by cm2187 4mo ago
But if you define a new type, how is that breaking backward compatibility?
- pjmlp 4mo agoBecause that is missing the point. All the types that are value types in semantics, e.g. Optional, should be proper value types on Valhalla. Additionally, they should be compatible with existing code that expects them as parameters, fields,.... without being recompiled from source. If it is a complete new type without backwards compatibility, no one is going to adopt it, other than a few niche cases.
- gf000 4mo agoWell, my old code can have a List<Object>, and I can pass my new type into it and have it do some operations. Let alone with reflection - so backwards compatibility is more complex than that. As for structs, Java avoids e.g. tearing issues with making them immutable, while it is easy to optimize it to local modification under the hood.