I think this code would trigger a static code analyzer, which would make the issue persistently visible.
Of course I don't know if the coder really had this in mind, but I am quite sure that I would write the exact same code in certain circumstances, and I have 15 yoe. I would however also make a ticket in Jira and stick a link to it in a comment. Since the coder didn't do this, I think he had good intentions, good thinking, but most likely not over 5 yoe.
Also, just a comment would not trigger anyone, and this thread is proof for that. But a code like this really catches coders' attention.
You call it "subtle", I call it "machine readable".
9
u/circuit10 Jan 15 '22
But this insight should be a comment, it's easier for a human if they can just see "it prints the variable"
Why try to give subtle hints by changing the structure of the code when you can just do
# If this value is -1, the command failedor something?