Hacker News new | ask | show | jobs
by namuol 2729 days ago
I use comments to document assumptions that are likely to be wrong, either now as I write it, or later when someone (probably myself) changes it.

It is absolutely useful to do, and really not too difficult.

Languages that allow for more formal assumption-checking (especially before runtime) are even better, but comments have an additional benefit of being understood by a human directly.

I wish languages with static analysis could somehow allow authors to encode human-friendly/sematic errors that you often see as runtime exceptions into the static analysis itself...