Hacker News new | past | comments | ask | show | jobs | submit login

If I recall Nim doesn't even allow tabs. Programming languages should not be overly opinionated in formatting, especially when it requires extra bytes to use spaces.



> Programming languages should not be overly opinionated in formatting

I think gofmt, python black, etc have demonstrated that it's usually better to have a single standard then it is to fight endlessly about these details.


They have demonstrated that some people have interest in controlling formatting.

It would be a stretch to say they demonstrated that it’s better to enforce a standard.

Black, itself, changed rules many times within a 1-year period to the point our own CI would fail on existing code that previously passed.


> CI would fail on existing code that previously passed.

You problem isn’t that black changed formatting rules, your problem is that you didn’t pin CI dependencies. This isn’t a unique problem to black, any other tool used in CI pipelines can cause things to break if you don’t pin them.


Indeed. Something wihout security impact will use pointless resources when you update. Do it rarely (or never if possible).


It's funny you say that, because Go and Python are two of my least favorite languages, partially for reasons of formatting.


I disagree entirely. Ideally there should be one valid way to format your code, and robust tools to make that formatting happen automatically.

Allowing alternatives yields zero benefit and causes pointless debates and diffs.


The benefit is, what if I don't like four spaces as indentation? What if I like two? Why do other get to force their aesthetic preferences on me when there already exists the tab character, whose apparent width is configurable?


> causes pointless debates

yes, having languages establish an immutable standard for tabs vs spaces has clearly ended all debate over them.


But it actually kind of has ended this nonsense in the go community, and to a lesser extent in the rust community.


If it helps, you can configure your text editor of choice to auto-swap tabs for spaces. However, I share your displeasure for the gesture.


Do the extra bytes matter?


Programming languages shouldn't even consider whitespace (except perhaps new lines) syntactically important at all, so the whole discussion is silly. Once you've decided whitespace is important you might as well make emoji part of the syntax.


I disagree: if we make languages have NWS (Non-optional WhiteSpace) then we can easily disambiguate between:

  let traversed-distance := yard-length;
And:

  let traversed-distance := yard - length;
Which is valuable as kebab-case is best case.


Why not? Making identation part of the syntax allows more for less?


You cannot cut and paste freely when indentation matter


Yes ok, but this is not very limiting and doesn't make this approach a ridiculous and failed one to start with, as the OP originally suggested and those languages which do it disprove already?


Because indentation-based languages have very limited formatting they can do. They can't do any indentation formatting.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: