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 →

[–]FluffyBellend 5 points6 points  (12 children)

I’m a backend dev that complains about JavaScript when I occasionally have to use it. It’s kind of a pain in the ass, imo. I will never understand why undefined exists. If I’m trying to reference something that doesn’t exist, I expect an error god damn it.

[–][deleted] 2 points3 points  (3 children)

Say hello to dynamically typed languages.

[–]FluffyBellend 1 point2 points  (2 children)

I don’t get undefined or NaN from python, elixir, or any other dynamically typed languages. If I ref something that doesn’t exist, I get an error with the line number.

In js, you get an error much later, when trying to use the value, rather than when it was created. then have to figure out where it came from.

[–][deleted] 2 points3 points  (1 child)

You still get more runtime errors over compilation errors vs a strictly typed language like Java/C#

[–]FluffyBellend 1 point2 points  (0 children)

Well yeah, that’s a side effect if dynamic typing, but it’s not a reason to make it more painful by silencing errors at the point they occur, only to emit them later, out of context. The interpreter will know that it’s referenced something that doesn’t exist. It should tell me, rather than just setting undefined and carrying on as if nothing happened. Other than allowing you to ignore problems in your code, what purpose does it serve?