Skip to content

re: Something I've come to appreciate about dynamic typing VIEW POST

re: The cleaner solution is only possible because Javascript doesn't check the types of objects or fields at compile-time. It's arguable if it's clea...

Thank you for the response. I guess my example wasn't a very good one. We have situations like a <select> in the UI that controls which field to sort customers by, so we knew all the values were valid, and didn't have to do null-checking or error-handling.

I guess I wouldn't know if other statically typed languages have better solutions. Go, Haskell, and C are the only statically typed languages I know (and mostly Go).


I get it, there really are some situations — especially in web development — where typing can become painful (looking at you, JSON).

When writing Go one has essentially two options: mourn the relatively primitive type system and try to find clever workarounds or embrace Go for what it is and write the explicit slightly longer version. The correct answer is almost always the latter, as it's pretty much what the language designers expect you to do.

code of conduct - report abuse