|
|
|
|
|
by msla
1315 days ago
|
|
And it isn't even all that useful as your only metric: A hypothetical language with only strings can have strong typing if it only allows you to do stringly things on those strings and doesn't, for example, allow you to ever see the codepoints as sequences of bytes; however, you'd have to represent everything in that language as strings, so the semantic types of those objects would be purely conceptual, like types in BCPL, where the compiler only knew about machine words, or, indeed, assembly language. So we have at least three axes: Static vs Dynamic, Weak vs Strong, and Conceptual vs Semantic, where more Semantically-typed languages allow you to represent more of the meaning you're going for in the type system, and have the language enforce semantic rules like not being able to add person-height to person-weight even if they're both integral types. (Note that my imaginary string-only language is also statically typed of necessity, given that all variables must have type string and no value can ever move from a variable of one type to a variable of another type.) |
|