4 ms·
Another way to phrase this is “statically typed languages suck if you want to write highly dynamically typed code.” That’s true. I think there’s 3 options here:
by yashap 4y ago
Another way to phrase this is “statically typed languages suck if you want to write highly dynamically typed code.” That’s true. I think there’s 3 options here:
1. Keep writing code in a very dynamically typed style, despite choosing a statically typed language. Just deal with/stomach the extreme type complexity that is necessary to model your dynamic style statically
2. Keep writing code in a very dynamically typed style, and switch to a dynamically typed language
3. Stop writing code in a very dynamically typed style. If you’re using a statically typed language, write code that embraces static types
IMO 2 and 3 are both reasonable choices, but the author is deciding to choose 1, which is of course painful. I strongly disagree that libraries must be super dynamic though - that’s a pure style choice that some library authors adopt, but you can absolutely write basically any library in a static types friendly style, you just need to reflect that in your interfaces.
I guess the one thing that IS TS specific is that ppl can write their libs in JS, then try to add types to it, and if they chose crazy dynamic interfaces, it will be an incredible pain to statically type. But honestly, you could just say “this is a JS lib, there will be no TS types.”
- boffinism 4y ago> Another way to phrase this is “statically typed languages suck if you want to write highly dynamically typed code.” Reminds me a lot of the NoSQL wars which eventually boiled down to 'Non-relational databases suck if you want to store highly relational data'. As ever, there are no silver bullets, only the right tools for certain jobs.