I've never seen a language's style guide recommend avoiding comments before
11–20 of 198 posts
Re: I've never seen a language's style guide recommend avoiding comments before
#12Re: I've never seen a language's style guide recommend avoiding comments before
#13This submission needs to have a different title. It's not very clear whether the submitter is being genuinely surprised or sarcastic.
If the OP meant to be sarcastic, that's just like me saying "yes" when I mean "no"---my mistake, not yours, and you can't be blamed for assuming I meant what I said.
Re: I've never seen a language's style guide recommend avoiding comments before
#14 -- swap the elements of a pair
swap :: (a,b) -> (b,a)
Yes this is redundant. let b=a+1 -- add one to 'a'
Yes this is also redundantDoes it mean that every piece of code can be expressed as clearly as in a one-line comment in natural language? I don't think so.
Re: I've never seen a language's style guide recommend avoiding comments before
#15Re: I've never seen a language's style guide recommend avoiding comments before
#16Comment only magical code, but don't write magical code.
Re: I've never seen a language's style guide recommend avoiding comments before
#17Re: I've never seen a language's style guide recommend avoiding comments before
#18This is not convincing to me because the examples are trivial: -- swap the elements of a pair swap :: (a,b) -> (b,a) Yes this is redundant. let b=a+1 -- add one to 'a' Yes this is also redundant Does it mean that every piece of code can be expressed as clearly as in a one-line comment in natural language? I don't think so.
Re: I've never seen a language's style guide recommend avoiding comments before
#19Re: I've never seen a language's style guide recommend avoiding comments before
#20It allows you to document the intended inputs and outputs of the function and state its purpose. This increases maintainability and reusability.
Functions themselves should be short and written as a sequence of logical steps.
I'm also a big fan of doing things right rather than just hacking until it works, which seems to put me in a minority.