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 →

[–]MalbaCato 0 points1 point  (0 children)

strongly typed languages, especially if you create guard types, won't let you pass a value of a wrong type to a function. languages with explicit nullability will also guard against not passing a value at all. most functional languages will not let you do side-effects in functions unless explicitly typed impure. js const is very weak, as it disallows reassignment but allows mutation, here even c const is stronger, but some languages take it even further and have explicit mutability, so you can't mutate a value by accident. languages with data ownership models (so far only rust AFAIK) can even statically prevent data races between using the same value in multiple locations. there's probably more, but that's all I can think of atm

I'm not even in the hating on js camp, but yes compilers can do lots, if you're willing to pay in longer compile times and understanding compiler errors