4 ms·
I agree with the comment about assembly of course, but ironically I find myself spending more time writing comments when programming in high level languages lik
by charles-salvia 10y ago
I agree with the comment about assembly of course, but ironically I find myself spending more time writing comments when programming in high level languages like Python, rather than in C. The reason most of the time seems to be that many high level scripting languages (like Python) are dynamically typed languages. So things like function definitions contain no information (other than the variable name) that explains what the inputs/arguments might actually be. I often find myself having to write comments to make it clear what the parameters are supposed to be so someone reading the code instantly understands what needs to be passed to the function, whereas in a language like C or C++ that has static typing, the type would make it obvious.
- chriswarbo 10y ago> I often find myself having to write comments to make it clear what the parameters are supposed to be so someone reading the code instantly understands what needs to be passed to the function, whereas in a language like C or C++ that has static typing, the type would make it obvious. I'd encourage turning these sorts of 'comments' into Javadoc-style 'annotations'; they're still comments, so language implementation will ignore them, but that small amount of structure makes it possible for separate tools to perform sanity checks (i.e. obvious combinations of incompatibly-annotated types), or even to show annotations at call sites in an IDE (e.g. when hovering over a name).