Remix.run Logo
INTPenis 8 hours ago

Non english speaker trying to wrap my head around what Brendan said to you.

I was once told that the tab key can be represented in different ways on different systems, and that's why spaces are safer because they're always represented the same.

Is that what Brendan was trying to say?

jimbokun 8 hours ago | parent | next [-]

Literally try entering a "tab" character in a Hacker News reply. For me in Safari, it changes the focus to the "reply" button.

It's literally difficult to enter a "tab" character into many text entry fields and dialogs and applications, because it's used so often as a navigation key.

kccqzy 30 minutes ago | parent | next [-]

It is Control-Q Control-I. Control-Q is the quoted insert function, and Control-I is the traditional teletype way of typing a tab 0x09 (just like Control-C in a terminal results in 0x03 when not in a cooked mode).

I only found this because I am an Emacs user and I instinctively tried Control-Q first (because many other key bindings like C-f or C-b work). The Control-I bit is a guess that worked. I cannot imagine a non-technical user knowing how to insert a tab character in Safari.

Waterluvian 27 minutes ago | parent | prev | next [-]

I can’t find the tab key on my phone. Please advise.

7 hours ago | parent | prev [-]
[deleted]
Someone 7 hours ago | parent | prev | next [-]

> I was once told that the tab key can be represented in different ways on different systems, and that's why spaces are safer because they're always represented the same.

The main counter argument is that users have different preferences for the amount of indentation, so giving them control over that, just as they (nowadays) have control over the font used and window width, is a good idea.

The tongue-in-cheek counter argument is that fixed-width spaces are preferable over ‘normal’ spaces. They also give you more control over indentation, allowing, for example, mixing usage of THREE-PER-EM SPACE (https://unicode-explorer.com/c/2004) for indentation with FIGURE SPACE (https://unicode-explorer.com/c/2007) for right-aligning numbers.

ville 8 hours ago | parent | prev | next [-]

No, the point was that pressing the Tab key often does something else than inserts the tab character. Moves focus to the next input field, for example.

bnjms 8 hours ago | parent | prev | next [-]

Tab key is both a control character moving the cursor to the next input and also an input representing the tab character as you see in a text editor.

Now that im thinking about it I’m convinced capslock would have been superior next field key and alt+capslock to be used for toggling capslock. But it’s not obvious to me capslock [e: must be] seen by the OS. It could be changed on the keyboards themselves.

srdjanr 7 hours ago | parent [-]

It definitely is visible, OS login screens usually warn you if caps lock is on when typing password

bnjms 4 hours ago | parent [-]

Thanks for the correction. I understand it is seen but wonder if it was in keyboard only in the past.

kstrauser 8 hours ago | parent | prev | next [-]

No, it's that it's extremely challenging to insert a literal tab character into anything resembling a web form.

You can configure your editor so that pressing the tab key inserts a tab character. Good luck with a web browser, or a UI where tab moves focus to the next control. The space bar basically always inserts a space character.

sam_lowry_ 8 hours ago | parent | prev | next [-]

BTW, Douglas Crockford had an interesting argument in favour of spaces, see https://www.youtube.com/watch?v=En8Ubs2k1O8

IshKebab 8 hours ago | parent | prev | next [-]

No he's saying if you're trying to write code in an edit box in a web browser (for example) and you press tab, instead of inserting a tab character it will move the focus to the next input field.

Bullshit reasoning though, because even people who use spaces for indentation don't do it by hammering the space bar - they also press the tab key. And of course in modern browsers we can give tab the expected behaviour.

The only logic I've ever heard for using spaces for indentation that actually makes sense and I vaguely agree with, is that lots of programmers do not give a shit about formatting code and even using spaces properly is often a bit too much for them.

That doesn't matter so much if you have an autoformatter though, so with the exception of Go I don't know why modern languages with widely used autoformatters don't use tabs.

smohare 7 hours ago | parent [-]

[dead]

darkwater 8 hours ago | parent | prev | next [-]

[flagged]

bigibas123 7 hours ago | parent | prev [-]

Brendan Eich was making a point about the tab key also being used to switch to different text fields and buttons. This makes it difficult to type in certain applications. A space doesn't have that issue.

About your point of tab being represented different on different systems: It will always be ascii 9, how it's draw does differ between text editors but I consider that one of it's strengths for programming. Everyone can configure what an indent looks like for them, it makes reading code easier.

setr 7 hours ago | parent | next [-]

Little irritates me more than logging into a new system, opening up code in vim, and witnessing the insanity of tabs-as-8-spaces

dylan604 6 hours ago | parent [-]

For me, it's not until that file is retrieved for local use where I have to deal with this. If it was born remotely and only used remotely with the same settings, I never notice it. But yeah, I hate it with the passion that raises my temp to that of a thousand suns.

foxglacier 5 hours ago | parent [-]

The solution is to exterminate tabs, not hope everybody's settings are the same. I only code in editors that auto-convert tabs to spaces.

foxglacier 5 hours ago | parent | prev [-]

Having a non-standard size is exactly the reason the tab character (not the key) is unusable. If you accidentally get some space indenting anywhere in the same project as tabs, then it'll be misaligned on someone's editor and they'll "fix" it, making it misaligned on someone else's. Trying to never use space indenting is impossible. Never copy and paste from anywhere else, never manually align multi-line statements, never align comments with code, etc.