Say I have a function that takes some arguments that fall under a bunch of constraints, e.g. one of them has to be an integer, another has to be a string of length at least 10, et cetera. In general, is it the function writer's (i.e. my) responsibility to have a bunch of
asserts or whatever to enforce these preconditions, and throw errors if any are violated? Or should I just let the function proceed anyway and have the caller deal with any errors or weird output they get from it? My reasoning is that on one hand, it's simpler in terms of debugging if an error is thrown immediately when a precondition is violated, but on the other hand, it might be easier overall for the caller to read the documentation of the function rather than me padding it with a whole load of
As a side question, if I'm writing functions that only I will be using, is the answer the same, or do I just do whatever I feel most comfortable with?