Hacker News new | ask | show | jobs
by Confusion 6280 days ago
Functions only work for a very specific set of input types. On all other inputs, something goes wrong, but that 'something' can take quite a bit of investigating to figure out. Therefore, an assertion that verifies that the input is indeed part of that specific set of input types is valuable: it catches the problem at the earliest possible moment and it pinpoints the exact problem.
1 comments

For every other type of error, hah, rely on what I said then?