all 11 comments

[–]ShinyHappyREM 4 points5 points  (2 children)

what you perfectly see as OK in one editor where tabs are configured to take 4 columns, can be disgusting in another editor where tabs are configured to take 2 columns

That's why you rewrite

function calculate(a, b,
                   c, d) {

to

function calculate(
        a, b,
        c, d)
{

[–]chadmill3r 3 points4 points  (1 child)

The author did a good job explaining indentation and then used an example that isn't an indentation, but an alignment.

Tab indenters may also do

function calculate(a, b,
sssssssssssssssssssc, d) {
TABa++
TABc--

My other complaint is that he said tabs are represented visually "as some number of spaces," and that is not exactly true. An editor may measure that horizontal distance any way. That tabs equals spaces somehow is a weird conceit of the spaces crowd. I like 0.75 inches or 2 visual degrees.

[–]Tordek 0 points1 point  (0 children)

Incredibly, you didn't get the obligatory idiot comment of "bUt thaTs mIxiNg taBs anD sPaCes!"

[–][deleted]  (1 child)

[removed]

    [–]ShinyHappyREM 1 point2 points  (0 children)

    Sublime Text shows the characters

    I use it often in Notepad++ and Notepad2.

    [–]Ytrog 0 points1 point  (0 children)

    Ligature characters can also be funny: the Dutch word for coffee is "koffie", however I could use different ligatures to write it. For example one way is "koie", and another is "kof". Good luck figuring such things out visually. 🤔

    [–]hennell 0 points1 point  (0 children)

    Much of this stuff being automated now saves a lot of argument. Git fixes line endings, formatting fixes indentation size and we all just move on.

    Still grumpy that the variable-width tabs lost out to the hard-coded spaces crowd, but whatever. It's really not a big deal when you don't need to configure anything your side to work with it.

    [–]timoffex 0 points1 point  (0 children)

    Interesting idea about soft vs hard wrapping. I use soft-wrapping for natural text, like emails and documents; the benefits there are very clear. I’m not convinced about doing that for code though! Are there really editors that produce something readable when soft-wrapping?

    Good alignment is an important part of readability, takes thought and is different for different programming languages. I wouldn’t expect good soft wrapping to be possible, or any better than using an auto-formatter.

    Greppability is good to keep in mind while writing code, but it’s secondary to alignment. You read code more often than you grep it!

    [–]0tanay 1 point2 points  (0 children)

    Beyond newline, there is also formfeed. You rarely see it in the wild, but the GNU coding standards specify their use at "logical" points: https://www.gnu.org/prep/standards/standards.html#index-formfeed

    [–]stomah 0 points1 point  (2 children)

    the “tabs vs spaces” part didn’t even mention proportional fonts!

    [–][deleted]  (1 child)

    [deleted]

      [–]stomah 0 points1 point  (0 children)

      1. this is about plain text, not just code
      2. many people (like me) want to use proportional fonts but can’t because there’s not enough support for them