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.
It was a typo, but I also wanted to add that type coercion is not dynamic typing, the coercion can be done statically during compile time, so it could not be the 2nd one, even if it wasn’t a typo
Do you mean type coercion?
From my perspective, dynamic typing IS type corrosion!
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.
Type coercion = Allow types to be converted to other types automatically to perform some operations like comparison.
Type corrosion = some non-standard condescending term to say that dynamic typing has no proper rigid types?
It was obviously a typo
It was a typo, but I also wanted to add that type coercion is not dynamic typing, the coercion can be done statically during compile time, so it could not be the 2nd one, even if it wasn’t a typo
Dyac