3 ms·
I'm a space person, but I disagree with the premise of the first two points. Exotic alignment such as trying to align equal signs on different lines together d
by cryptica 5y ago
I'm a space person, but I disagree with the premise of the first two points.
Exotic alignment such as trying to align equal signs on different lines together doesn't make sense... All the different cases are too difficult to describe in simple words. So it's better to simply not do it. IMO, the only whitespace in code should be to separate different tokens/words and for indentation. Adding whitespace to create any other kinds of visual effects should be discouraged.
I ended up using spaces, entirely because of the last point and because there are many products out there which render tabs really poorly. I literally can't trust people to be sensible about how wide an indent should look.
- ensiferum 5y agoAligning stuff is awesome for multiline editing however. Which happens more than one night think!
- stinos 5y agoHow so? I.e. in what situation multiline editing works less good when things aren't aligned?
- CRConrad 5y agoIf the GP's "multiline editing" means what is also called "block selection" (e.g. using Alt + arrow keys in Notepad++), then multiline editing won't work -- logically, just simply cannot work -- unless the text is aligned. Which is one reason why I think that was what was meant. The other reason is, this is pretty much the only reasonable interpretation of "multiline editing" I can see here. Which makes me intensely curious: What did you mean by, or think was meant by, "multiline editing"?
- stinos 5y agoThere's more than block selection which is actually quite limiting in comparison with the other possibilities. What I do often (SublimeText, VSCode for instance) is select a token, select a bunch of occurrences of that over multiple lines, then start editing from there. So in the case of e.g. unaligned equal signs select the first one, Ctrl-D to select the equals sign on the next lines, then move cursor around word by word and edit. Or indeed start by creating multiple cursors at the front of a line and start from there. Etc.
- kstenerud 5y agoI've seen it used to great effect for describing code sections, either using ASCII diagrams, tables, sample output, etc. The point is, formatted monospace text will happen (albeit rarely), and when it does you want it to remain intact despite user settings.
- alpaca128 5y ago> Exotic alignment such as trying to align equal signs on different lines together doesn't make sense It makes a lot of sense in some situations and makes the code much more readable. A long list of declarations, configuration options, or a pattern matching block with many short cases can look a lot less chaotic when you align them. Of course it should be done in moderation. And as someone already mentioned, for things like block selection and editing it makes quite a difference.
- Kuraj 5y agoOnly if my compulsive hitting of the auto-formatting tool doesn't immediately break it.