News for hackers. Stuff that matters.
Re:On Comments in Code by ratww on Tuesday June 15, 2021 @06:08PM (#27522160)
I also do this with optimisations, when I work on low-level code:

If I come up with an inefficient algorithm that's short and readable, I tend to optimise it to something better but leave the reference implementation inside a code block.

(This goes without saying, but: I don't leave "commented code", but code inside comment, generally formatted with Markdown)

Re:On Comments in Code by Nullabillity on Tuesday June 15, 2021 @06:42PM (#27522540)
Sounds like a good use case for property testing!
Re:On Comments in Code by Hasnep on Tuesday June 15, 2021 @06:39PM (#27522519)
Is there a reason you don't leave a comment with the commit hash of the change instead?
Re:On Comments in Code by mjevans on Tuesday June 15, 2021 @09:24PM (#27523851)
Some day in the distant future someone will only have a tarball of the source of the last version that worked; if they're lucky.

Save that poor sod; have your comments live in your code, not in an SCM system for your code.

Re:On Comments in Code by owl57 on Tuesday June 15, 2021 @09:42PM (#27523958)
GPL has this idea in it: trying to define what exactly should go into that tarball. The question seems meaningful and important even for proprietary code. If some authors assume that anybody modifying their code should be able to look at git commits, that probably simply means that "the preferred form of the work for making modifications to it" is a git repo.
Re:On Comments in Code by ratww on Wednesday June 16, 2021 @02:47AM (#27525601)
Yes, text is better for convenience and for being future-proof. It's like leaving a description of the bug I'm fixing, instead of just a JIRA ticket identifier.