4 ms·
> Simonyi mistakenly used the word type in his paper, and generations of programmers misunderstood what he meant. Simony actually distinguish between two meani
by goto11 4y ago
> Simonyi mistakenly used the word type in his paper, and generations of programmers misunderstood what he meant.
Simony actually distinguish between two meanings of "type":
(1) A set of valid operations for a value
(2) The storage representation of a value
For example he suggest the "sz" prefix for a pointer to a zero-terminated string and "st" for a pointer to a length-prefixed string. Both are represented as the same storage type (a pointer), but obviously different operations are valid on them.
Hungarian notations is a way to represent types-1 in a language which only support types-2. It is obviously bad to mix up the two kinds of string-pointers, but since the type system cannot represent the distinction we have to use Hungarian notation and then very carefully review the code to make sure the operations conform to the type-1 type.
But the types which Simonyi encoded in the variable names is clearly what would be represented as types in modern languages.