4 ms·
In theory I agree, but having recently worked in a code base that used tabs, it was painfully obviously that some devs displayed them as 4 spaces and some as 2
by eloisius 5y ago
In theory I agree, but having recently worked in a code base that used tabs, it was painfully obviously that some devs displayed them as 4 spaces and some as 2 because they would visually align things for their editor’s configuration. It was very ugly.
- cjfd 5y agoThat is why one should use tabs for indentation and spaces for alignment. Then this problem does not occur.
- pjmlp 5y agoJust like with C and static analysers, there is the "one should" and what the large majority actually ends up doing, as usually no one enforces anything on large code bases in most development shops.
- j1elo 5y agoJust like the ethos "If the backup process is not automatic, it won't happen", I'd like to propose "If the formatting style is not already enforced by default, there is no formatting style".
- kstenerud 5y agoThe moment you begin talking about "should", everything goes out the window because humans will thwart you. The only way to be 100% sure is to avoid multi-space characters like tab in the first place.
- eloisius 5y agoNah that’s exactly how the alignment did occur. Spaces would be mixed with tabs to align things with 4 spaces aligning to each tab. Since I don’t like to view 3 virtuously splits I don’t like all the wasted indentation space and I view tabs as 2 spaces. It was obvious when someone didn’t consider how it would like if a tab wasn’t 4 spaces.
- throwawayffffas 5y agoMy personal preference to solving this problem is a simple rule. "No alignment allowed.", Then you only need to worry about indentation, and the character used does not matter.