4 ms·
When you say "value types" in this context, you mean "copy-only types"?
by wool_gather 7y ago
When you say "value types" in this context, you mean "copy-only types"?
- kllrnohj 7y agoI mean "value types" https://www.jesperdj.com/2015/10/04/project-valhalla-value-types/ https://www.jesperdj.com/2015/10/04/project-valhalla-value-t... & http://cr.openjdk.java.net/~jrose/values/values-0.html http://cr.openjdk.java.net/~jrose/values/values-0.html I don't know what you mean by "copy-only types." I'm not finding any reference to that terminology in the context of language design.
- wool_gather 7y agoAh, thanks for the link; I wasn't sure what it meant in the context of Java, since it's possible to get value semantics using a class. Sorry about the confusion. I meant for the quotes around "copy-only" to indicate that it wasn't really a standard term, but I marked "value types" the same way, so that didn't really work. By "copy-only" I meant something you couldn't have more than one reference to: every name (variable) to which you assign the data would have its own independent copy.
- kllrnohj 7y ago> By "copy-only" I meant something you couldn't have more than one reference to: every name (variable) to which you assign the data would have its own independent copy. That's not really a requirement of value types, no. C# has value types (structs) and you can have references to them as well (ref & out params). In general though yes it would be typically copied around, same as an 'int' is. Particularly if Java doesn't add something equivalent to ref/out params.
- wool_gather 7y agoI know, that's why I asked for clarification originally. :) Anyways, I appreciate the details.