mtbc: maze I (white-red)
Mark T. B. Carroll ([personal profile] mtbc) wrote2021-11-10 04:42 am
Entry tags:

Whitespace can show similar code

While I am generally in favor of standards for code style in writing software, one thing that disappoints me is when I am prohibited from adding extra whitespace. Sometimes, I have similar-looking code where I could use spaces and breaks to show the variation clearly by aligning the similar portions directly underneath each other. However, the formatters become upset at the extra space and my code must instead look neat from their point of view but less clear from mine. The latest of so many past examples is,
Guide.__new_plane([w1/2, -h1/2, 0],
                  [-w1/2, -h1/2, 0],
                  [w2/2, -h2/2, l])
where I would prefer to write,
Guide.__new_plane([ w1/2, -h1/2, 0],
                  [-w1/2, -h1/2, 0],
                  [ w2/2, -h2/2, l])
In this case I could pad with + but usually I do not have such a workaround available.
lovelyangel: (Eve Angel)

[personal profile] lovelyangel 2021-11-10 04:08 pm (UTC)(link)
Yeah, I would use whitespace for visual alignment also. But it was easier back in the day when there was less code sharing and text editors were bare bones.
mellowtigger: (penguin coder)

[personal profile] mellowtigger 2021-11-10 11:48 pm (UTC)(link)
I agree with that part, yes. I'm a big fan of Egyptian braces, though, if your proposed syntax allows for that too. ;)
Guide.__new_plane(
 [ w1/2, -h1/2, 0],
 [-w1/2, -h1/2, 0],
 [ w2/2, -h2/2, l]
)

squirrelitude: (Default)

[personal profile] squirrelitude 2021-11-15 03:40 am (UTC)(link)
This is a place where I would definitely tell the linter to hush for that line or function.