Search code examples
language-agnostictype-theory

Understanding the difference between types and representations


This article speaks of the difference between types and classes. Since I've only worked with languages that treat both as identical, please suggest material/programming-languages that will teach me the difference.


Solution

  • Difference is not the right word - classes are certainly types. But not all types are classes. Note also that the word "class" is quite vague - it could be just a tuple type (with no operations except construction and projection - a C struct so to speak) or, on the other side of the spectrum, a class that contains only methods, but no state.