3 ms·
This is the number one feature I look for in a language now. It’s hard to describe why value semantics are useful when thinking about a language as it exists to
by amw-zero 6y ago
This is the number one feature I look for in a language now. It’s hard to describe why value semantics are useful when thinking about a language as it exists today, since the language influences what we think is possible. But having records and tuples like this changes the way you write code.
The biggest example is, you don’t have to think in terms of references anymore. Again it’s hard to explain how much were forced to think about references and specific locations that data happens to live at, but that thinking is pervasive in how we write code (if you’re using a language like JS, which most popular languages are like).
Value semantics means you can stop thinking about data-as-a-location or data-as-a-reference and finally start thinking about data-as-data. If two records have the same values, they are the same. This means you don’t need to know anything about where data came from, you can construct matching data and say “are these things equal?” And they will be. This inherently reduces coupling and complexity.