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

> The thing is, why 10? Why not 9 or 11?

Check the first Unicode codepoints, 10 is defined there:

000A is LINE FEED (LF) = new line (NL), end of line (EOL)

It was already 10 in ASCII too (and the first 128 codepoints of Unicode are mostly the same as ASCII [I think there are a few tiny differences in some control characters]).

So to answer your question: it's neither 9 nor 11 because '\n' stands for "new line" and not for "character tabulation" nor for "line tabulation" (which 9 and 11 respectively stands for).

> Clearly at some point someone must've manually programmed a `'n' => 10` mapping

I don't disagree with that.



> Check the first Unicode codepoints, 10 is defined there

The point is how the compiler knows that. Read the article.





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

Search: