views:

119

answers:

2

Purely wondering... since they're still around and in use in C# today...

Where did the pattern of using string escape codes come from? What language did it first appear in? What languages, if any, have solved the problem in a different way?

+3  A: 

I suspect that these escape codes originated in B, a high-level assembly programming language for the Honeywell 6000 GCOS operating system. This language was developed at Bell Labs based on a British language called BCPL. Because BCPL was rather wordy, the B developers simplified the syntax and added things like braces to replace BEGIN and END. That's where the name B came from, because it was an abbreviated form of BCPL.

Later on some people at Bell Labs created a language that was the successor to B, mainly by adding typing and a standard I/O library. Because it was B's successor, they chose the next letter in the name BCPL.

I do not recall seeing the backslash notation before B, and since C and UNIX inherited it from B, I thing that B is the origin of this notation, or more specifically, that Bell Labs was the origin. It's entirely possible that this notation was used in other Bell Labs software before B, since they were a prolific producer of software, much of which was distributed freely to universities such as the one which I attended in the mid 1970's.

By the way, the idea of an escape sequence existed long before that, dating back to the 19th century Baudot code which was a fixed length 5 bit binary code intended to replace variable length Morse code. Baudot had SI (Shift In) and SO (Shift Out) codes that escaped letters into their capital variation, just like the Shift key on a typewriter.

Michael Dillon
The backslash notation is a C development, B used an asterisk('*n'). http://cm.bell-labs.com/cm/cs/who/dmr/btut.html
jbcreix
A: 

i would comment but i cant yet, very interesting topic routeNpingme, and thank you Michael Todd for the link.

GnrlBzik
very funny : / now ...
GnrlBzik