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

How about all whitespace should be represented by one character to reduce ambiguity. I shouldn't have to figure out if 'l' is 'ell' or 'eye'. Same way I should not have see visually whitespace and wonder if it's tab or space. One visualization, one ascii representation.


Because whitespace is not a space includes margins the spacing between letters etc, we all ready have a word for the white space character you are talking about its called space and its not used for indentation.


Here was I thinking “tab” was for “tables”


I think this is where a lot of the trouble comes from: Tabs are misunderstood as "whitespace", as if code was some sort of DTP by a graphic designer. Code actually is a functional instruction to a machine - semantics matter, and this is where tabs shine: they are unambigious (did the developer decide to indent this this far, or not?)

If tabs-as-whitespace trouble you, editors since the 1990s have allowed you to choose/configure other representations of tabs.


I could literally not use any indentation and the machine would still understand me. Not sure how they matter for machines?

They do matter for humans though. The reason we write code and structure it the way we do is for human convenience. One of those conveniences is thinking of the layout of code as a visual help to scan and read it. As such I am very much organizing my code like a graphic designer would organize information.

Edit: Indentations do matter in some languages and used to signify information. But not in a lot of them. The point still stands that most of the time we are using them for visual purposes not information to the compiler/interpreter.


Only in the sense that all characters are "for visual purposes". Tabs have a distinct meaning from spaces, and can be rendered however you want (arrows or chevrons, for instance); "whitespace" is a poor term for them.


If I ever have to program in python, I'm absolutely going to pull out some of my obsolete translation programming and write a preprocessor that translates brackets to the semantically equivalent indentation, yes this will make python sort of an intermediate language LOL


I thought they were for aligning columns in a table (hence “tab”), rather than indentation? This goes back to typewriters. Sure you could abuse it for indentation and perhaps that became common practice at one point but it doesn’t mean that’s what it’s “for” any more than spaces.


> This goes back to typewriters. Sure you could abuse it for indentation and perhaps that became common practice at one point [...]

Indentation (specifically the first line of each paragraph) was arguably the first widespread use of the tab key. The annoyance with using it for actual tables was that generally you'd want numeric data to be right-justified (so that digits of equal significance align vertically). So I wouldn't really call it an abuse, especially on modern keyboards.


Arguably yes. And arguably spaces are better for indentation as a matter of convenience and accessiblity and you can’t make any strong argument that it’s what tab is “for” based on original purpose.


> and you can’t make any strong argument that it’s what tab is “for” based on original purpose

I didn't claim as such - I'm just contesting your claim that using tab for indentation is an "abuse" because it's "for aligning columns in a table".


That’s fine. You’re supporting my point in that case.


I'd say they're "for" whatever we want. Nowadays they're far more widely used for semantic indent than for tabular alignment.


Sorry I misunderstood you, I thought you were making the argument that spaces aren’t for indentation.




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

Search: