4 ms·
> often a mistake is made and "static typing" is confused with "strong" typing, and "dynamic typing" is confused with "weak typing". Do you identify that probl
by kazinator 9y ago
> often a mistake is made and "static typing" is confused with "strong" typing, and "dynamic typing" is confused with "weak typing".
Do you identify that problem in this specific video?
"Strong typing" is itself loaded. There is a definition of "strong typing" which means "no conversions occur between types without programmer requests".
For instance, under this notion, a language in which we cannot use an integer expression in a floating-point context without putting in an integer-to-float coercion is more strongly typed than one in which the conversion is inferred and takes place implicitly.
"Strong typing" has been used in reference to the facility, as in the Pascal family, for declaring type alias names for identical types (such as integers) such that the aliases are considered distinct types. The C typedef mechanism is weakly typed because a mode_t and pid_t, both perhaps just aliases for int, are considered to be indistiguishable from int and compatible. C++ has more strongly typed enum types than C, because a location of some enum type in C++ cannot be assigned a value of an integer type, or of a different enum type, without a cast.
Sometimes "strong typing" means that there are no holes in the type system: no datum is being misused if there are no diagnostics about type. (This is related to the other senses of "strong typing" because if an implicit conversion is allowed in a program which is free of type diagnostics, that conversion could be unsafe and hide a software defect. The type system knows very well that here there is an expression of real type and the context requires a integer value and silently generates the conversion; but what if it is out of range? In, C, the behavior of an out of range floating to integer conversion, and vice versa, is undefined.)
> Static typing requests you to explicitly declare types.
Not in anything that can be called state-of-the-art static typing, except at module boundaries (where the compiler cannot always infer parameter or return types since some of the information is in another module that it doesn't know about).
Types can be inferred implicitly from basic terms in the program syntax tree whose type information is known (like literal operands, standard functions and operators and such) and then from there by inference (which can also go in the other direction, like from known function parameters to unknown terms nested inside the function). https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_system https://en.wikipedia.org/wiki/Hindley%E2%80%93Milner_type_sy...
- fish_fan 9y ago> Sometimes "strong typing" means that there are no holes in the type system: no datum is being misused if there are no diagnostics about type. I have never heard this. I do, however, use "sound" and "soundness" for virtually rhe same thing. The reason why is because both of these terms are worthwhile as distinct, meaningul, well-defined terms. It also doesn't make sense: type correctness is a binary calculation. Strong is a comparative, which isn't super useful when there are only two values.