by randomdata · 2y ago · 0 comments
While similar, structural typing is seen statically (think compile time), duck typing is seen dynamically (think run time).
So I will go on to imagine duck-typing as the classic JS way where functions started with often pretty extensive runtime checks of their parameter values.
I guess this also means that duck-typing is inherently tied to checking primitive types and/or object structures, return values etc at runtime.