No it’s not, they’re completely different concepts. In C/C++ lingo Dynamic typing is having every variable be a void * whereas type coercion is implementing conversion functions for your types to allow casting between types, e.g. having a temperature class that can be casted to a double (or from it).
This is a function with dynamic typing and no type coercion in C/C++:
I’m making a Star Wars joke based on a typo. I know what type coercion is. The joke is that dynamic typing is corroded and disgusting to me. The Star Wars reference being Anakin saying from his perspective the Jedi were evil.
No it’s not, they’re completely different concepts. In C/C++ lingo Dynamic typing is having every variable be a
void *whereas type coercion is implementing conversion functions for your types to allow casting between types, e.g. having a temperature class that can be casted to a double (or from it).This is a function with dynamic typing and no type coercion in C/C++:
int foo(void* param) { Temperature* t = (Temperature*) param; return t->intValue() + 10; }This is the same function with type coercion and no dynamic typing in C/C++:
int foo(Temperature& t) { return t + 10; }I’m making a Star Wars joke based on a typo. I know what type coercion is. The joke is that dynamic typing is corroded and disgusting to me. The Star Wars reference being Anakin saying from his perspective the Jedi were evil.