Re:Are dynamic languages going to replace static languages? ...
by kaba0 on Wednesday August 04, 2021 @05:39AM
(#28059050)
With the same argument, why put C++ into the same bracket? It has much much more type safety than C.
Re:Are dynamic languages going to replace static languages? ...
by edflsafoiewq on Wednesday August 04, 2021 @07:03AM
(#28059590)
struct ID { uint32_t val; };
void check_id(struct ID id);
It is confusing that people talk about C in terms of being a typed language. The types are an annotation so the compiler knows how much memory to allocate / read. All the side benefits of having to spell that out are incidental.
That sort of typing is a distraction. A programmer does not care that they are passing 4 bytes as the first argument. That isn't really trying to squeeze anything useful out of a type system. They care that they are passing something recognised as an ID, not that it has 4 bytes.
Using C/C++ as an example of a typed language doesn't say much. The guarantees are more a culture of how to use the language than in the language itself.