[phobos] The time has come to destroy all y'all over CR/LF
Andrei Alexandrescu
andrei at erdani.com
Wed Jan 26 10:36:47 PST 2011
CR/LF sucks. There is no negotiation.
What are my credentials? I went to highschool in the late 80s but that
was Communist Romania, which turns the clock back by at least 15 years
so my expertise dates from the early 70s. My highschool was specializing
in IT, and I actually _worked_ on VT 100, which was a treat compared to
the punch card punchers that I'd started on.
So: indeed CR or '\r' means the carriage goes back to the beginning of
the line without changing the line. LF or '\n' means the paper feed
(those infinite papers with holes on the margins) goes forward one step.
On occasion you'd need CR without LF. The classic example is that you'd
print the line twice to simulate poor man's bold. Other tricks people
played were to simulate diacritics by overprinting e.g. 't' and ','. On
non-paper terminals, CR is great for quickly updating a line of
information without scrolling down. It's simpler than using curses and
effective.
But the fact of the matter is that you almost NEVER needed LF alone.
When you want the paper to scroll, you usually do so because you want to
print some more stuff starting the next line, not in the arbitrary point
that continues after the last character on the current line! You could
play games with LF followed by a number of backspaces but I never saw
anyone doing so. The only one place I've seen LF actually ever used was
in ASCII art and landscape ACII graphing programs, and even then it was
rare and an optimization that was insignificant in the grand scheme of
things.
So CR alone should be available as "go to the beginning of the current
line". LF alone should mean "go to the beginning of the next line". And
that should be it. Unix got this right. CP/M et al got this wrong.
Andrei
More information about the phobos
mailing list