Hacker News new | past | comments | ask | show | jobs | submit login

Call a function "foo" that expects 3 arguments with 5 or 2 arguments, instead.

Javascript will gladly accept that and not yield any error, not just at compile-time, but even at run-time!

Unless the function explicitly checks that the argument list is correct, it will simply hide the bug.

When changing function signatures in any language, it is the programmers' collective responsibility to fix all callers (some of which in the same working tree, some hidden in others' branches, etc). In a static-language, it is very easy, you get compile-time errors at some point. In dynamically typed languages, it is slightly harder -- you get an error (ideally under a test suite) and fix it there. In Javascript you get cryptic bugs. No compile-time error. No run-time error. Happy debugging!




How is that an issue ?


How is a common change (updating a function signature) easily causing cryptic bugs rather than a visible compile-time or run-time error an issue?

Bugs are bad?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: