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

Braces by itself are very poor visual indicators of a block, so they are almost always (except in one liners) coupled with indentation of the code inside the block. So, in a raw text form (ignoring newline and space chars) it's two characters to start a block (brace and a tab).

Sure, a good IDE will automatically create indentation when you type '{', so you need to only type a single character to start the block. We could actually say '{' is a shortcut key to start a block. IDE creates an indentation and draws a vertical line to enhance visual presentation of the block. Visually, braces are more or less just a noise, so removing them would improve "signal to noise ratio" and enhance reading experience.

However, logically braces are better at defining blocks of code than tabs. With braces we have start '{' and end '}' characters, but with tabs each line needs to be indented by a correct number of chars (tabs/spaces).

I am wondering, if we can have best of both worlds.

In some cases we are trying to draw visual indications with text. Wouldn't be better, if we let the IDE do the drawing? Eg.: two vs four spaces of indentation? It doesn't matter, if you can configure visual indentation depth on the fly in the IDE.



I've made a web based editor (https://webide.se/) that does automatic indentation. You can copy any JavaScript code into it and it will parse and indent. When using other editors i find it annoying to have to manually manage indentation and I do not miss the syntax errors that comes when there is a block mismatch and you have to figure out where that missing } should be...

There are languages like Python that uses "significant white space" where there are no curly braces and instead you use indentation to decide where a block ends. The problem with Python is that my editor has no way to know


> Braces by itself are very poor visual indicators of a block

And that's why better languages use the keywords "begin" and "end" in stead.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: