Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

It's surprising to me how software developers, supposedly very rational, cannot come to the obvious conclusion that the correct coding style is to have unlimited line length and using tabs for indent.

The reason that's the best choice is that it's the approach that provides logical data rather than a specific visual style, allowing people can just configure their editors to do word wrapping to whatever line length they prefer and set tab width to whatever value they prefer (including fractional values!), so it's strictly better than all alternatives.

And if someone doesn't like the editor word wrapping, they can always write an extension or patch for the editor to wrap in whatever syntax-aware way they want.

Also, while for some other bizarre reason it's traditional to program with monospace fonts, there is in fact no reason at all to use them instead of the more efficient proportional fonts, and if you use proportional fonts the concept of a length limit is meaningless.



> The reason that's the best choice is that it's the approach that provides logical data rather than a specific visual style, allowing people can just configure their editors to do word wrapping to whatever line length they prefer and set tab width to whatever value they prefer (including fractional values!), so it's strictly better than all alternatives.

But often you _do_ want to provide a specific visual style with your code. Vertical alignment is a powerful tool for communication and readability. Hence monospace and space-based indentation.

Also, word of advice: when a disagreement has been running for decades and involved thousands of people on both sides, casually describing your conclusion as "obvious" and belittling anyone who disagrees as "[not] very rational" signals superficiality, not intelligence.


I'd say your maximalist view is not maximal enough, by requiring tabs. Why not store code in the most minimal way possible (one-liner, no whitespace [assuming whitespace-insensitive languages]) and let viewers and editors wrap and indent it however they want.

That aside, I'd say the reason your vision is not achievable today is due to lack of great view/edit tools.


For a less-maximal outlook that is actually achievable with minimal editor support, check out elastic tabstops.

https://nickgravgaard.com/elastic-tabstops/

I've found that the last reason I can justify spaces has to do with hanging indents which are not aligned on tab bounaries. Elastic tabstops handles those with - you guessed it - tabs.


Thanks for the pointer. Elastic tabstops is a cool idea.


Also variable tabs! instead of being

    {
        {
            {
                {
                    {
                    }
                }
            }
        }
    }
they could be

    {
        {
           {
             {
              {
              }
             }
           }
        }
    }


"No reason to use monospace fonts at all" is a stretch. It can be nice to line things up easily.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: