Hacker News new | ask | show | jobs
by 1-more 1888 days ago
> you are doing a simple integer calculation and define that the negative numbers will be used as error codes to deal with side-effects

I had to come back to this because this kind of in-band signaling is how I've introduced bugs many-a-time in my old life. In FP it's so cheap to just make this function that can fail in some way return a wrapped up value that tells you what failed and how and _prevents_ you from doing math with what should be an error code (for instance).