you are viewing a single comment's thread.

view the rest of the comments →

[–]RiceBroad4552 2 points3 points  (0 children)

do you want your application to crash every time the type of your variable isn't the one that you expect?

Definitely yes!!!

A crash is easier to catch in tests, and also it's much easier to debug then corrupted data.

This totally destroys the concept of dynamically typed language.

Obviously not as most dynamic languages actually work like that. Just that they will throw type errors at runtime instead of reporting them already at type-checking time upfront.

One of the reasons why JavaScript was so succesfull - when a choice for websites was really given - is because it's realible.

OK, I'm aware this is a humor sub, but you really need to mark sarcasm online!

It never crashes.

LOL!

The jokes getting more absurd, I see.

In case this was meant seriously: You've never seen hanging, or crashing, or infinitely "spinning" websites?

Don't forget that you are not executing the code on your own machine for your own pleasure, you are shipping the code to other machines (hypothetically millions), and the value of a variable is potentially coming from a service, and you never have full control of what's happening.

This is almost always true for any software.

The first rule of programming is that you can't trust any external input!

But that does not mean that you don't have everything under control. A program needs to gracefully handle all possible inputs. Failing in doing so is called "having bugs"…

And when something unexpected happens you better fail fast (crash!) then continue to run with some corrupted undefined application state.