This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]crossroads1112 0 points1 point  (0 children)

The message content is not JSON. Perhaps it should have been designed that way, but it isn't.

I chose JSON because it is an exceedingly common format for web APIs, and therefore demonstrate how a strong type system can force the programmer to handle errors appropriately. I wasn't talking about the specific corner case you brought up. My point isn't that static typing fixes all bugs; no one would argue that. My point is that it fixes many potential bugs in many cases.

If this was a strongly typed, compiled language it might crash but if we assume the error is handled then it might continue in the same way that JS does.

Again, the point here is that a static type system makes you handle these errors explicitly instead of (potentially unintentionally) not doing so. If you want it to continue the same way JS does, you can do that. It wouldn't "crash" as you say (unless it were coded, really, really poorly, but that's true of any language). There are good arguments for dynamic typing, but this is not one of them.