News for hackers. Stuff that matters.
Re:Maybe comments should explain 'what' (2017) by zephen on Sunday January 04, 2026 @01:37PM (#46490821)
Mentally discarding a name still takes some amount of effort, even if local.

I often write things the way you have done it, for the simple reason that, when writing the code, maybe I feel that I might have more than one use for the constant, and I'm used to thinking algebraically.

Except, that I might make them global, at the top of a module. Why? Because they encode assumptions that might be useful to know at a glance.

And I probably wouldn't go back and remove the constants once they were named.

But I also have no problem with unnamed but commented constants like the ones in the comment you responded to.

There are no comments on this comment yet.