2 ms·
> horribly abuse the dynamic nature of JavaScript It's not a horrible abuse if you aren't trying to make the framework/library statically typed in the first pl
by munificent 6y ago
> horribly abuse the dynamic nature of JavaScript
It's not a horrible abuse if you aren't trying to make the framework/library statically typed in the first place.
Idiomatic APIs for dynamically typed languages use the flexibility of dynamic types. Idiomatic APIs for statically typed languages use the structure of static types.
The problem comes when you try to put one into the other's world. It's like watching a fish flop around on land. There's nothing intrinsically wrong with fish locomotion, it's just not optimized for that environment.
- ImprobableTruth 6y ago>It's not a horrible abuse if you aren't trying to make the framework/library statically typed in the first place. Of course it is, because even if there's no type system the people using the library still have to make sense of the complexity. A function with a dozen, context-sensitive overloads that accepts data without a clear pattern isn't just hard to type, it's also hard to understand for a user. Even with dynamic typing you should be able to clearly state what a function does.