Keep in mind that the concept of reference semantics is different from the concept of reference types:
-
A value type can have reference semantics. For example, a file descriptor on Unix platforms is a
CInt, but that definitely has reference semantics. -
A reference type can have value semantics. The most common example of this is an immutable class.
You can’t use the type system to check for reference semantics.
The question of how to formalise value and reference semantics is super subtle and has been discussed many times here on DevForums, to the point where folks have published research papers on the topic.
Share and Enjoy
Quinn “The Eskimo!” @ DTS @ Apple