2 ms·
They're superior only in C-like languages when you indent in constant-width levels, and then only if you use very short names in your code. Try using tabs to i
by TeMPOraL 10y ago
They're superior only in C-like languages when you indent in constant-width levels, and then only if you use very short names in your code.
Try using tabs to indent e.g. arguments to function one under another, and weep.
- dragonwriter 10y ago> Try using tabs to indent e.g. arguments to function one under another, and weep. Where the terms are distinguished in a programming context, that's alignment, not indentation; tabs for indentation, spaces for alignment is a common suggestion.
- TeMPOraL 10y agoSure, as long as you don't mix them on one line (i.e. first indent, then align), because then differences between tab widths will still break alignment.
- dragonwriter 10y agoFirst indent and then align will retain alignment with different tab widths, because you only align things that are at the same indent level, so different tab widths in a tab indent / space align combination just move the whole aligned block left or right without affecting alignment.
- TeMPOraL 10y agoI stand corrected.
- sophacles 10y agoNot if you do it right: \t\tsome_func(arg1, \t\t arg2, \t\t argN) will look right no matter what the tab width is.
- TeMPOraL 10y agoI just realised my invalid belief was caused by experiencing dumb editors in the past, which wouldn't recognise aligning and would turn your example into: \t\tsome_func(arg1, \t\t\t arg2, \t\t\t argN) I.e. they would replace all sequences of tab-width spaces with a tab character.
- OJFord 10y ago> Try using tabs to indent e.g. arguments to function one under another, and weep. I despise that formatting, and use: fn_with_many_args( very_long_arg1, very_long_arg2, very_long_arg3, very_long_arg4 ) which aligns fine with `\t\t`; so I shan't be weeping today, sorry! :)